Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 1 | /*! \file ipaccess.h */ |
| 2 | |
Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 3 | #pragma once |
Harald Welte | 4185fa5 | 2011-05-22 21:57:15 +0200 | [diff] [blame] | 4 | |
| 5 | #include <stdint.h> |
| 6 | |
| 7 | #define IPA_TCP_PORT_OML 3002 |
| 8 | #define IPA_TCP_PORT_RSL 3003 |
| 9 | |
| 10 | struct ipaccess_head { |
| 11 | uint16_t len; /* network byte order */ |
| 12 | uint8_t proto; |
| 13 | uint8_t data[0]; |
| 14 | } __attribute__ ((packed)); |
| 15 | |
| 16 | struct ipaccess_head_ext { |
| 17 | uint8_t proto; |
| 18 | uint8_t data[0]; |
| 19 | } __attribute__ ((packed)); |
| 20 | |
| 21 | enum ipaccess_proto { |
| 22 | IPAC_PROTO_RSL = 0x00, |
| 23 | IPAC_PROTO_IPACCESS = 0xfe, |
| 24 | IPAC_PROTO_SCCP = 0xfd, |
| 25 | IPAC_PROTO_OML = 0xff, |
| 26 | |
| 27 | |
| 28 | /* OpenBSC extensions */ |
| 29 | IPAC_PROTO_OSMO = 0xee, |
| 30 | IPAC_PROTO_MGCP_OLD = 0xfc, |
| 31 | }; |
| 32 | |
| 33 | enum ipaccess_proto_ext { |
| 34 | IPAC_PROTO_EXT_CTRL = 0x00, |
| 35 | IPAC_PROTO_EXT_MGCP = 0x01, |
| 36 | IPAC_PROTO_EXT_LAC = 0x02, |
Holger Hans Peter Freyther | 59b3175 | 2011-07-23 09:59:24 +0200 | [diff] [blame] | 37 | IPAC_PROTO_EXT_SMSC = 0x03, |
Harald Welte | 900e180 | 2014-08-18 11:34:17 +0200 | [diff] [blame] | 38 | IPAC_PROTO_EXT_ORC = 0x04, /* OML Router Control */ |
Holger Hans Peter Freyther | 4448048 | 2014-12-14 19:01:14 +0100 | [diff] [blame] | 39 | IPAC_PROTO_EXT_GSUP = 0x05, /* GSUP GPRS extension */ |
Neels Hofmeyr | 5eeb17a | 2015-09-23 23:18:15 +0200 | [diff] [blame] | 40 | IPAC_PROTO_EXT_OAP = 0x06, /* Osmocom Authn Protocol */ |
Harald Welte | b99ed7f | 2018-08-13 20:54:44 +0200 | [diff] [blame] | 41 | IPAC_PROTO_EXT_RSPRO = 0x07, /* Remote SIM protocol */ |
Harald Welte | 4185fa5 | 2011-05-22 21:57:15 +0200 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | enum ipaccess_msgtype { |
| 45 | IPAC_MSGT_PING = 0x00, |
| 46 | IPAC_MSGT_PONG = 0x01, |
| 47 | IPAC_MSGT_ID_GET = 0x04, |
| 48 | IPAC_MSGT_ID_RESP = 0x05, |
| 49 | IPAC_MSGT_ID_ACK = 0x06, |
| 50 | |
| 51 | /* OpenBSC extension */ |
| 52 | IPAC_MSGT_SCCP_OLD = 0xff, |
| 53 | }; |
| 54 | |
| 55 | enum ipaccess_id_tags { |
| 56 | IPAC_IDTAG_SERNR = 0x00, |
| 57 | IPAC_IDTAG_UNITNAME = 0x01, |
| 58 | IPAC_IDTAG_LOCATION1 = 0x02, |
| 59 | IPAC_IDTAG_LOCATION2 = 0x03, |
| 60 | IPAC_IDTAG_EQUIPVERS = 0x04, |
| 61 | IPAC_IDTAG_SWVERSION = 0x05, |
| 62 | IPAC_IDTAG_IPADDR = 0x06, |
| 63 | IPAC_IDTAG_MACADDR = 0x07, |
| 64 | IPAC_IDTAG_UNIT = 0x08, |
| 65 | }; |
| 66 | |
| 67 | /* |
| 68 | * Firmware specific header |
| 69 | */ |
| 70 | struct sdp_firmware { |
| 71 | char magic[4]; |
| 72 | char more_magic[2]; |
| 73 | uint16_t more_more_magic; |
| 74 | uint32_t header_length; |
| 75 | uint32_t file_length; |
| 76 | char sw_part[20]; |
| 77 | char text1[64]; |
| 78 | char time[12]; |
| 79 | char date[14]; |
| 80 | char text2[10]; |
| 81 | char version[20]; |
| 82 | uint16_t table_offset; |
| 83 | /* stuff i don't know */ |
| 84 | } __attribute__((packed)); |
| 85 | |
| 86 | struct sdp_header_entry { |
| 87 | uint16_t something1; |
| 88 | char text1[64]; |
| 89 | char time[12]; |
| 90 | char date[14]; |
| 91 | char text2[10]; |
| 92 | char version[20]; |
| 93 | uint32_t length; |
| 94 | uint32_t addr1; |
| 95 | uint32_t addr2; |
| 96 | uint32_t start; |
| 97 | } __attribute__((packed)); |