diff options
author | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-10-17 19:49:33 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2011-10-17 22:12:42 +0200 |
commit | 20c660caecc95b03489f870945ae9fe91c839bd3 (patch) | |
tree | 77a64e776b56212768574aa8e3bd2a48136969eb /include | |
parent | 1434e40951a4eda107e2e81425f99a2d5de23975 (diff) |
ipa: initial addition of helper functions and examples
This patch adds IPA helper function that can be use on top of stream
sockets.
The current API is just a copy and paste from libosmo-abis, it will
change in follow up patches to improve it.
Diffstat (limited to 'include')
-rw-r--r-- | include/osmocom/netif/Makefile.am | 1 | ||||
-rw-r--r-- | include/osmocom/netif/ipa.h | 52 |
2 files changed, 53 insertions, 0 deletions
diff --git a/include/osmocom/netif/Makefile.am b/include/osmocom/netif/Makefile.am index afab204..4e63846 100644 --- a/include/osmocom/netif/Makefile.am +++ b/include/osmocom/netif/Makefile.am @@ -1,4 +1,5 @@ osmonetif_HEADERS = datagram.h \ + ipa.h \ stream.h osmonetifdir = $(includedir)/osmocom/netif diff --git a/include/osmocom/netif/ipa.h b/include/osmocom/netif/ipa.h new file mode 100644 index 0000000..5b53b3a --- /dev/null +++ b/include/osmocom/netif/ipa.h @@ -0,0 +1,52 @@ +#ifndef _OSMO_NETIF_IPA_H_ +#define _OSMO_NETIF_IPA_H_ + +struct ipa_head { + uint16_t len; /* network byte order */ + uint8_t proto; + uint8_t data[0]; +} __attribute__ ((packed)); + +/* IPA protocols. */ +#define IPAC_PROTO_RSL 0x00 +#define IPAC_PROTO_IPACCESS 0xfe +#define IPAC_PROTO_SCCP 0xfd +#define IPAC_PROTO_OML 0xff +#define IPAC_PROTO_OSMO 0xee /* OpenBSC extension. */ +#define IPAC_PROTO_MGCP_OLD 0xfc /* OpenBSC extension. */ + +struct ipa_head_ext { + uint8_t proto; + uint8_t data[0]; +} __attribute__ ((packed)); + +/* Protocol extensions. */ +#define IPAC_PROTO_EXT_CTRL 0x00 +#define IPAC_PROTO_EXT_MGCP 0x01 +#define IPAC_PROTO_EXT_LAC 0x02 + +/* Message types. */ +#define IPAC_MSGT_PING 0x00 +#define IPAC_MSGT_PONG 0x01 +#define IPAC_MSGT_ID_GET 0x04 +#define IPAC_MSGT_ID_RESP 0x05 +#define IPAC_MSGT_ID_ACK 0x06 +#define IPAC_MSGT_SCCP_OLD 0xff /* OpenBSC extension */ + +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, +}; + +struct msgb *osmo_ipa_msg_alloc(int headroom); +void osmo_ipa_msg_push_header(struct msgb *msg, uint8_t proto); +int osmo_ipa_msg_recv(int fd, struct msgb *msg); + +#endif |