abis: use ipaccess protocol header from libosmogsm

This commit is contained in:
Harald Welte 2011-05-22 22:00:45 +02:00
parent 8a183fb423
commit cbda62ee76
2 changed files with 7 additions and 42 deletions

View File

@ -3,46 +3,11 @@
#include <osmocom/core/select.h>
#include <osmocom/core/timer.h>
#define IPA_TCP_PORT_OML 3002
#define IPA_TCP_PORT_RSL 3003
#include <osmocom/gsm/protocol/ipaccess.h>
#define OML_RETRY_TIMER 5
#define OML_PING_TIMER 20
struct ipabis_head {
u_int16_t len; /* network byte order */
u_int8_t proto;
u_int8_t data[0];
} __attribute__ ((packed));
enum ipabis_proto {
IPA_PROTO_RSL = 0x00,
IPA_PROTO_IPACCESS = 0xfe,
IPA_PROTO_SCCP = 0xfd,
IPA_PROTO_OML = 0xff,
};
enum ipabis_msgtype {
IPA_MSGT_PING = 0x00,
IPA_MSGT_PONG = 0x01,
IPA_MSGT_ID_GET = 0x04,
IPA_MSGT_ID_RESP = 0x05,
IPA_MSGT_ID_ACK = 0x06,
};
enum ipabis_id_tags {
IPA_IDTAG_SERNR = 0x00,
IPA_IDTAG_UNITNAME = 0x01,
IPA_IDTAG_LOCATION1 = 0x02,
IPA_IDTAG_LOCATION2 = 0x03,
IPA_IDTAG_EQUIPVERS = 0x04,
IPA_IDTAG_SWVERSION = 0x05,
IPA_IDTAG_IPADDR = 0x06,
IPA_IDTAG_MACADDR = 0x07,
IPA_IDTAG_UNIT = 0x08,
};
struct ipabis_link {
int state;
struct osmocom_bts *bts; /* set, if OML link */

View File

@ -66,7 +66,7 @@ struct msgb *abis_msgb_alloc(int headroom)
{
struct msgb *nmsg;
headroom += sizeof(struct ipabis_head);
headroom += sizeof(struct ipaccess_head);
nmsg = msgb_alloc_headroom(ABIS_ALLOC_SIZE + headroom,
headroom, "Abis/IP");
@ -77,10 +77,10 @@ struct msgb *abis_msgb_alloc(int headroom)
void abis_push_ipa(struct msgb *msg, uint8_t proto)
{
struct ipabis_head *nhh;
struct ipaccess_head *nhh;
msg->l2h = msg->data;
nhh = (struct ipabis_head *) msgb_push(msg, sizeof(*nhh));
nhh = (struct ipaccess_head *) msgb_push(msg, sizeof(*nhh));
nhh->proto = proto;
nhh->len = htons(msgb_l2len(msg));
}
@ -236,7 +236,7 @@ rsl_tx_chan_rqd(link->bts->trx[0]);
/* receive message from BSC */
static int abis_rx(struct ipabis_link *link, struct msgb *msg)
{
struct ipabis_head *hh = (struct ipabis_head *) msg->data;
struct ipaccess_head *hh = (struct ipaccess_head *) msg->data;
int ret = 0;
switch (hh->proto) {
@ -312,7 +312,7 @@ static void abis_timeout(void *arg)
static int abis_sock_cb(struct osmo_fd *bfd, unsigned int what)
{
struct ipabis_link *link = bfd->data;
struct ipabis_head *hh;
struct ipaccess_head *hh;
struct msgb *msg;
int ret = 0;
@ -337,7 +337,7 @@ static int abis_sock_cb(struct osmo_fd *bfd, unsigned int what)
return -ENOMEM;
}
msg = link->rx_msg;
hh = (struct ipabis_head *) msg->data;
hh = (struct ipaccess_head *) msg->data;
if (msg->len < sizeof(*hh)) {
ret = recv(link->bfd.fd, msg->data, sizeof(*hh), 0);
if (ret <= 0) {