2009-02-15 15:32:53 +00:00
|
|
|
#ifndef _IPACCESS_H
|
|
|
|
#define _IPACCESS_H
|
|
|
|
|
2009-10-22 13:48:59 +00:00
|
|
|
#include "e1_input.h"
|
split 'libosmocore' from openbsc codebase
This library is intended to collect all generic/common funcitionality
of all Osmocom.org projects, including OpenBSC but also OsmocomBB
The library currently includes the following modules:
bitvec, comp128, gsm_utils, msgb, select, signal, statistics, talloc, timer,
tlv_parse, linuxlist
msgb allocation error debugging had to be temporarily disabled as it depends on
'debug.c' functionality which at the moment remains in OpenBSC
2010-02-20 15:24:02 +00:00
|
|
|
#include <osmocore/linuxlist.h>
|
2009-10-22 13:48:59 +00:00
|
|
|
|
2009-12-23 21:47:53 +00:00
|
|
|
#define IPA_TCP_PORT_OML 3002
|
|
|
|
#define IPA_TCP_PORT_RSL 3003
|
|
|
|
|
2009-02-15 15:32:53 +00:00
|
|
|
struct ipaccess_head {
|
2009-10-29 15:33:59 +00:00
|
|
|
u_int16_t len; /* network byte order */
|
2009-02-15 15:32:53 +00:00
|
|
|
u_int8_t proto;
|
|
|
|
u_int8_t data[0];
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
|
|
|
enum ipaccess_proto {
|
|
|
|
IPAC_PROTO_RSL = 0x00,
|
|
|
|
IPAC_PROTO_IPACCESS = 0xfe,
|
2009-09-30 04:26:38 +00:00
|
|
|
IPAC_PROTO_SCCP = 0xfd,
|
2009-02-15 15:32:53 +00:00
|
|
|
IPAC_PROTO_OML = 0xff,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ipaccess_msgtype {
|
|
|
|
IPAC_MSGT_PING = 0x00,
|
|
|
|
IPAC_MSGT_PONG = 0x01,
|
|
|
|
IPAC_MSGT_ID_GET = 0x04,
|
|
|
|
IPAC_MSGT_ID_RESP = 0x05,
|
|
|
|
IPAC_MSGT_ID_ACK = 0x06,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ipaccess_id_tags {
|
|
|
|
IPAC_IDTAG_SERNR = 0x00,
|
|
|
|
IPAC_IDTAG_UNITNAME = 0x01,
|
|
|
|
IPAC_IDTAG_LOCATION1 = 0x02,
|
|
|
|
IPAC_IDTAG_LOCATION2 = 0x03,
|
|
|
|
IPAC_IDTAG_EQUIPVERS = 0x04,
|
|
|
|
IPAC_IDTAG_SWVERSION = 0x05,
|
|
|
|
IPAC_IDTAG_IPADDR = 0x06,
|
|
|
|
IPAC_IDTAG_MACADDR = 0x07,
|
|
|
|
IPAC_IDTAG_UNIT = 0x08,
|
|
|
|
};
|
|
|
|
|
2009-08-10 05:54:02 +00:00
|
|
|
int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa);
|
|
|
|
|
2009-08-18 08:05:45 +00:00
|
|
|
/*
|
|
|
|
* methods for parsing and sending a message
|
|
|
|
*/
|
|
|
|
int ipaccess_rcvmsg_base(struct msgb *msg, struct bsc_fd *bfd);
|
|
|
|
struct msgb *ipaccess_read_msg(struct bsc_fd *bfd, int *error);
|
|
|
|
void ipaccess_prepend_header(struct msgb *msg, int proto);
|
2010-01-13 08:06:46 +00:00
|
|
|
int ipaccess_send_id_ack(int fd);
|
2010-02-07 11:04:07 +00:00
|
|
|
int ipaccess_send_id_req(int fd);
|
2009-08-18 08:05:45 +00:00
|
|
|
|
2010-02-09 13:37:23 +00:00
|
|
|
int ipaccess_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len);
|
|
|
|
|
|
|
|
|
2009-12-30 04:56:49 +00:00
|
|
|
/*
|
|
|
|
* Firmware specific header
|
|
|
|
*/
|
|
|
|
struct sdp_firmware {
|
|
|
|
char magic[4];
|
|
|
|
char more_magic[2];
|
|
|
|
u_int16_t more_more_magic;
|
|
|
|
u_int32_t header_length;
|
|
|
|
u_int32_t file_length;
|
|
|
|
char sw_part[20];
|
|
|
|
char text1[64];
|
|
|
|
char time[12];
|
|
|
|
char date[14];
|
|
|
|
char text2[10];
|
|
|
|
char version[20];
|
|
|
|
u_int8_t dummy[2];
|
|
|
|
u_int16_t part_length;
|
|
|
|
/* stuff i don't know */
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
2009-12-30 05:10:56 +00:00
|
|
|
struct sdp_header_entry {
|
|
|
|
u_int16_t something1;
|
|
|
|
char text1[64];
|
|
|
|
char time[12];
|
|
|
|
char date[14];
|
|
|
|
char text2[10];
|
|
|
|
char version[20];
|
|
|
|
u_int32_t length;
|
|
|
|
u_int32_t addr1;
|
|
|
|
u_int32_t addr2;
|
|
|
|
u_int32_t start;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
2009-12-30 05:13:36 +00:00
|
|
|
struct sdp_header_item {
|
2009-12-30 05:10:56 +00:00
|
|
|
struct sdp_header_entry header_entry;
|
|
|
|
struct llist_head entry;
|
|
|
|
};
|
|
|
|
|
2009-12-30 04:56:49 +00:00
|
|
|
struct sdp_header {
|
|
|
|
struct sdp_firmware firmware_info;
|
2009-12-30 05:10:56 +00:00
|
|
|
|
|
|
|
/* for more_magic a list of sdp_header_entry_list */
|
|
|
|
struct llist_head header_list;
|
|
|
|
|
|
|
|
/* the entry of the sdp_header */
|
|
|
|
struct llist_head entry;
|
2009-12-30 04:56:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int ipaccess_analyze_file(int fd, const unsigned int st_size, const unsigned base_offset, struct llist_head *list);
|
|
|
|
|
2009-02-15 15:32:53 +00:00
|
|
|
#endif /* _IPACCESS_H */
|