Harald Welte | 4f361fc | 2009-02-15 15:32:53 +0000 | [diff] [blame] | 1 | #ifndef _IPACCESS_H |
| 2 | #define _IPACCESS_H |
| 3 | |
Holger Hans Peter Freyther | 0e7b073 | 2009-10-22 15:48:59 +0200 | [diff] [blame] | 4 | #include "e1_input.h" |
Holger Hans Peter Freyther | 4a98cad | 2009-12-30 05:56:49 +0100 | [diff] [blame^] | 5 | #include "linuxlist.h" |
Holger Hans Peter Freyther | 0e7b073 | 2009-10-22 15:48:59 +0200 | [diff] [blame] | 6 | |
Harald Welte | 87ed5cd | 2009-12-23 22:47:53 +0100 | [diff] [blame] | 7 | #define IPA_TCP_PORT_OML 3002 |
| 8 | #define IPA_TCP_PORT_RSL 3003 |
| 9 | |
Harald Welte | 4f361fc | 2009-02-15 15:32:53 +0000 | [diff] [blame] | 10 | struct ipaccess_head { |
Sylvain Munaut | d7d1c99 | 2009-10-29 16:33:59 +0100 | [diff] [blame] | 11 | u_int16_t len; /* network byte order */ |
Harald Welte | 4f361fc | 2009-02-15 15:32:53 +0000 | [diff] [blame] | 12 | u_int8_t proto; |
| 13 | u_int8_t data[0]; |
| 14 | } __attribute__ ((packed)); |
| 15 | |
| 16 | enum ipaccess_proto { |
| 17 | IPAC_PROTO_RSL = 0x00, |
| 18 | IPAC_PROTO_IPACCESS = 0xfe, |
Holger Hans Peter Freyther | f734a14 | 2009-09-30 06:26:38 +0200 | [diff] [blame] | 19 | IPAC_PROTO_SCCP = 0xfd, |
Harald Welte | 4f361fc | 2009-02-15 15:32:53 +0000 | [diff] [blame] | 20 | IPAC_PROTO_OML = 0xff, |
| 21 | }; |
| 22 | |
| 23 | enum ipaccess_msgtype { |
| 24 | IPAC_MSGT_PING = 0x00, |
| 25 | IPAC_MSGT_PONG = 0x01, |
| 26 | IPAC_MSGT_ID_GET = 0x04, |
| 27 | IPAC_MSGT_ID_RESP = 0x05, |
| 28 | IPAC_MSGT_ID_ACK = 0x06, |
| 29 | }; |
| 30 | |
| 31 | enum ipaccess_id_tags { |
| 32 | IPAC_IDTAG_SERNR = 0x00, |
| 33 | IPAC_IDTAG_UNITNAME = 0x01, |
| 34 | IPAC_IDTAG_LOCATION1 = 0x02, |
| 35 | IPAC_IDTAG_LOCATION2 = 0x03, |
| 36 | IPAC_IDTAG_EQUIPVERS = 0x04, |
| 37 | IPAC_IDTAG_SWVERSION = 0x05, |
| 38 | IPAC_IDTAG_IPADDR = 0x06, |
| 39 | IPAC_IDTAG_MACADDR = 0x07, |
| 40 | IPAC_IDTAG_UNIT = 0x08, |
| 41 | }; |
| 42 | |
Holger Hans Peter Freyther | 34e9749 | 2009-08-10 07:54:02 +0200 | [diff] [blame] | 43 | int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa); |
| 44 | |
Holger Hans Peter Freyther | d5f0522 | 2009-08-18 10:05:45 +0200 | [diff] [blame] | 45 | /* |
| 46 | * methods for parsing and sending a message |
| 47 | */ |
| 48 | int ipaccess_rcvmsg_base(struct msgb *msg, struct bsc_fd *bfd); |
| 49 | struct msgb *ipaccess_read_msg(struct bsc_fd *bfd, int *error); |
| 50 | void ipaccess_prepend_header(struct msgb *msg, int proto); |
| 51 | |
Holger Hans Peter Freyther | 4a98cad | 2009-12-30 05:56:49 +0100 | [diff] [blame^] | 52 | /* |
| 53 | * Firmware specific header |
| 54 | */ |
| 55 | struct sdp_firmware { |
| 56 | char magic[4]; |
| 57 | char more_magic[2]; |
| 58 | u_int16_t more_more_magic; |
| 59 | u_int32_t header_length; |
| 60 | u_int32_t file_length; |
| 61 | char sw_part[20]; |
| 62 | char text1[64]; |
| 63 | char time[12]; |
| 64 | char date[14]; |
| 65 | char text2[10]; |
| 66 | char version[20]; |
| 67 | u_int8_t dummy[2]; |
| 68 | u_int16_t part_length; |
| 69 | /* stuff i don't know */ |
| 70 | } __attribute__((packed)); |
| 71 | |
| 72 | struct sdp_header { |
| 73 | struct sdp_firmware firmware_info; |
| 74 | struct llist_head list; |
| 75 | }; |
| 76 | |
| 77 | int ipaccess_analyze_file(int fd, const unsigned int st_size, const unsigned base_offset, struct llist_head *list); |
| 78 | |
Harald Welte | 4f361fc | 2009-02-15 15:32:53 +0000 | [diff] [blame] | 79 | #endif /* _IPACCESS_H */ |