Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 1 | #ifndef _IPACCESS_H |
| 2 | #define _IPACCESS_H |
| 3 | |
| 4 | #include <laf0rge1/linuxlist.h> |
| 5 | |
| 6 | #define IPA_TCP_PORT_OML 3002 |
| 7 | #define IPA_TCP_PORT_RSL 3003 |
| 8 | |
| 9 | struct ipaccess_head { |
| 10 | u_int16_t len; /* network byte order */ |
Holger Hans Peter Freyther | 5aa1701 | 2010-07-31 04:37:26 +0800 | [diff] [blame^] | 11 | uint8_t proto; |
| 12 | uint8_t data[0]; |
Holger Hans Peter Freyther | 97f66e2 | 2010-07-28 03:32:52 +0800 | [diff] [blame] | 13 | } __attribute__ ((packed)); |
| 14 | |
| 15 | enum ipaccess_proto { |
| 16 | IPAC_PROTO_RSL = 0x00, |
| 17 | IPAC_PROTO_IPACCESS = 0xfe, |
| 18 | IPAC_PROTO_SCCP = 0xfd, |
| 19 | IPAC_PROTO_OML = 0xff, |
| 20 | }; |
| 21 | |
| 22 | enum ipaccess_msgtype { |
| 23 | IPAC_MSGT_PING = 0x00, |
| 24 | IPAC_MSGT_PONG = 0x01, |
| 25 | IPAC_MSGT_ID_GET = 0x04, |
| 26 | IPAC_MSGT_ID_RESP = 0x05, |
| 27 | IPAC_MSGT_ID_ACK = 0x06, |
| 28 | }; |
| 29 | |
| 30 | enum ipaccess_id_tags { |
| 31 | IPAC_IDTAG_SERNR = 0x00, |
| 32 | IPAC_IDTAG_UNITNAME = 0x01, |
| 33 | IPAC_IDTAG_LOCATION1 = 0x02, |
| 34 | IPAC_IDTAG_LOCATION2 = 0x03, |
| 35 | IPAC_IDTAG_EQUIPVERS = 0x04, |
| 36 | IPAC_IDTAG_SWVERSION = 0x05, |
| 37 | IPAC_IDTAG_IPADDR = 0x06, |
| 38 | IPAC_IDTAG_MACADDR = 0x07, |
| 39 | IPAC_IDTAG_UNIT = 0x08, |
| 40 | }; |
| 41 | |
| 42 | /* |
| 43 | * methods for parsing and sending a message |
| 44 | */ |
| 45 | int ipaccess_rcvmsg_base(struct msgb *msg, struct bsc_fd *bfd); |
| 46 | struct msgb *ipaccess_read_msg(struct bsc_fd *bfd, int *error); |
| 47 | void ipaccess_prepend_header(struct msgb *msg, int proto); |
| 48 | int ipaccess_send_id_ack(int fd); |
| 49 | int ipaccess_send_id_req(int fd); |
| 50 | |
| 51 | |
| 52 | #endif /* _IPACCESS_H */ |