ipa.h
Go to the documentation of this file.
#pragma once
#include <stdint.h>
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/tlv.h>
struct osmo_fd;
/* internal (host-only) data structure */
struct ipaccess_unit {
uint16_t site_id;
uint16_t bts_id;
uint16_t trx_id;
char *unit_name;
char *equipvers;
char *swversion;
uint8_t mac_addr[6];
char *location1;
char *location2;
char *serno;
};
/* obtain the human-readable name of an IPA CCM ID TAG */
const char *ipa_ccm_idtag_name(uint8_t tag);
/* parse a buffer of ID tags into a osmocom TLV style representation */
int ipa_ccm_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len);
/* Is the TAG included in the length field? */
int ipa_ccm_idtag_parse_off(struct tlv_parsed *dec, unsigned char *buf, int len, const int len_offset);
/* parse an Unit ID in string format into the 'ipaccess_unit' data structure */
int ipa_parse_unitid(const char *str, struct ipaccess_unit *unit_data);
/* fill a 'struct ipaccess_unit' based on a parsed IDTAG TLV */
int ipa_ccm_tlv_to_unitdata(struct ipaccess_unit *ud,
const struct tlv_parsed *tp);
struct msgb *ipa_ccm_make_id_resp(const struct ipaccess_unit *dev,
const uint8_t *ies_req, unsigned int num_ies_req);
struct msgb *ipa_ccm_make_id_resp_from_req(const struct ipaccess_unit *dev,
const uint8_t *data, unsigned int len);
/* Send an IPA message to the given FD */
int ipa_send(int fd, const void *msg, size_t msglen);
/* Send an IPA CCM PONG via the given FD */
int ipa_ccm_send_pong(int fd);
/* Send an IPA CCM ID_ACK via the given FD */
int ipa_ccm_send_id_ack(int fd);
/* Send an IPA CCM ID_REQ via the given FD */
int ipa_ccm_send_id_req(int fd);
/* Common handling of IPA CCM, BSC side */
int ipa_ccm_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd);
/* Common handling of IPA CCM, BTS side */
int ipa_ccm_rcvmsg_bts_base(struct msgb *msg, struct osmo_fd *bfd);
/* prepend (push) an ipaccess_head_ext to the msgb */
void ipa_prepend_header_ext(struct msgb *msg, int proto);
/* prepend (push) an ipaccess_head to the msgb */
void ipa_prepend_header(struct msgb *msg, int proto);
struct msgb *ipa_msg_alloc(int headroom);
int ipa_msg_recv(int fd, struct msgb **rmsg);
int ipa_msg_recv_buffered(int fd, struct msgb **rmsg, struct msgb **tmp_msg);
len
uint8_t len
Definition: gsm_04_11.h:2
data
uint8_t data[0]
message payload data
Definition: gsm_03_41.h:34
ipa_ccm_send_pong
int ipa_ccm_send_pong(int fd)
Definition: ipa.c:355
ipa_ccm_tlv_to_unitdata
int ipa_ccm_tlv_to_unitdata(struct ipaccess_unit *ud, const struct tlv_parsed *tp)
Definition: ipa.c:173
ipa_parse_unitid
int ipa_parse_unitid(const char *str, struct ipaccess_unit *unit_data)
Definition: ipa.c:140
ipaccess_unit::location1
char * location1
Definition: ipa.h:21
ipa_send
int ipa_send(int fd, const void *msg, size_t msglen)
Definition: ipa.c:341
ipaccess_unit::mac_addr
uint8_t mac_addr[6]
Definition: ipa.h:20
ipa_ccm_idtag_parse_off
int ipa_ccm_idtag_parse_off(struct tlv_parsed *dec, unsigned char *buf, int len, const int len_offset)
Definition: ipa.c:106
proto
uint8_t proto
Definition: ipaccess.h:3
ipaccess_unit::trx_id
uint16_t trx_id
Definition: ipa.h:16
ipa_ccm_send_id_ack
int ipa_ccm_send_id_ack(int fd)
Definition: ipa.c:360
ipa_msg_recv
int ipa_msg_recv(int fd, struct msgb **rmsg)
ipaccess_unit::equipvers
char * equipvers
Definition: ipa.h:18
ipa_ccm_make_id_resp
struct msgb * ipa_ccm_make_id_resp(const struct ipaccess_unit *dev, const uint8_t *ies_req, unsigned int num_ies_req)
Generate IPA CCM ID RESP based on list of IEs.
Definition: ipa.c:224
ipaccess_unit::serno
char * serno
Definition: ipa.h:23
ipa_msg_recv_buffered
int ipa_msg_recv_buffered(int fd, struct msgb **rmsg, struct msgb **tmp_msg)
ipaccess_unit::swversion
char * swversion
Definition: ipa.h:19
ipa_ccm_make_id_resp_from_req
struct msgb * ipa_ccm_make_id_resp_from_req(const struct ipaccess_unit *dev, const uint8_t *data, unsigned int len)
Generate IPA CCM ID RESP based on requets payload.
Definition: ipa.c:307
ipa_ccm_rcvmsg_bts_base
int ipa_ccm_rcvmsg_bts_base(struct msgb *msg, struct osmo_fd *bfd)
Definition: ipa.c:409
ipa_prepend_header
void ipa_prepend_header(struct msgb *msg, int proto)
Definition: ipa.c:442
ipa_ccm_rcvmsg_base
int ipa_ccm_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd)
Definition: ipa.c:371
ipa_ccm_send_id_req
int ipa_ccm_send_id_req(int fd)
Definition: ipa.c:365
ipaccess_unit::location2
char * location2
Definition: ipa.h:22
ipa_ccm_idtag_parse
int ipa_ccm_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len)
Definition: ipa.c:101
ipaccess_unit::unit_name
char * unit_name
Definition: ipa.h:17
ipaccess_unit::bts_id
uint16_t bts_id
Definition: ipa.h:15
ipa_msg_alloc
struct msgb * ipa_msg_alloc(int headroom)
Definition: ipa.c:586
ipa_prepend_header_ext
void ipa_prepend_header_ext(struct msgb *msg, int proto)
Definition: ipa.c:433
ipa_ccm_idtag_name
const char * ipa_ccm_idtag_name(uint8_t tag)
Definition: ipa.c:93
tlv.h
ipaccess_unit
Definition: ipa.h:13
tlv_parsed
result of the TLV parser
Definition: tlv.h:424
ipaccess_unit::site_id
uint16_t site_id
Definition: ipa.h:14