libosmogsm  0.12.0
Osmocom GSM library
ipa.h
Go to the documentation of this file.
1 
3 #pragma once
4 
5 #include <stdint.h>
6 
7 #include <osmocom/core/msgb.h>
8 #include <osmocom/gsm/tlv.h>
9 
10 struct osmo_fd;
11 
12 /* internal (host-only) data structure */
13 struct ipaccess_unit {
14  uint16_t site_id;
15  uint16_t bts_id;
16  uint16_t trx_id;
17  char *unit_name;
18  char *equipvers;
19  char *swversion;
20  uint8_t mac_addr[6];
21  char *location1;
22  char *location2;
23  char *serno;
24 };
25 
26 /* obtain the human-readable name of an IPA CCM ID TAG */
27 const char *ipa_ccm_idtag_name(uint8_t tag);
28 
29 /* parse a buffer of ID tags into a osmocom TLV style representation */
30 int ipa_ccm_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len);
31 
32 /* Is the TAG included in the length field? */
33 int ipa_ccm_idtag_parse_off(struct tlv_parsed *dec, unsigned char *buf, int len, const int len_offset);
34 
35 /* parse an Unit ID in string format into the 'ipaccess_unit' data structure */
36 int ipa_parse_unitid(const char *str, struct ipaccess_unit *unit_data);
37 
38 /* fill a 'struct ipaccess_unit' based on a parsed IDTAG TLV */
40  const struct tlv_parsed *tp);
41 
42 
43 struct msgb *ipa_ccm_make_id_resp(const struct ipaccess_unit *dev,
44  const uint8_t *ies_req, unsigned int num_ies_req);
45 
46 struct msgb *ipa_ccm_make_id_resp_from_req(const struct ipaccess_unit *dev,
47  const uint8_t *data, unsigned int len);
48 
49 /* Send an IPA message to the given FD */
50 int ipa_send(int fd, const void *msg, size_t msglen);
51 
52 /* Send an IPA CCM PONG via the given FD */
53 int ipa_ccm_send_pong(int fd);
54 
55 /* Send an IPA CCM ID_ACK via the given FD */
56 int ipa_ccm_send_id_ack(int fd);
57 
58 /* Send an IPA CCM ID_REQ via the given FD */
59 int ipa_ccm_send_id_req(int fd);
60 
61 /* Common handling of IPA CCM, BSC side */
62 int ipa_ccm_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd);
63 
64 /* Common handling of IPA CCM, BTS side */
65 int ipa_ccm_rcvmsg_bts_base(struct msgb *msg, struct osmo_fd *bfd);
66 
67 /* prepend (push) an ipaccess_head_ext to the msgb */
68 void ipa_prepend_header_ext(struct msgb *msg, int proto);
69 
70 /* prepend (push) an ipaccess_head to the msgb */
71 void ipa_prepend_header(struct msgb *msg, int proto);
72 
73 struct msgb *ipa_msg_alloc(int headroom);
74 
75 int ipa_msg_recv(int fd, struct msgb **rmsg);
76 int ipa_msg_recv_buffered(int fd, struct msgb **rmsg, struct msgb **tmp_msg);
int ipa_parse_unitid(const char *str, struct ipaccess_unit *unit_data)
Definition: ipa.c:140
int ipa_msg_recv(int fd, struct msgb **rmsg)
uint16_t bts_id
Definition: ipa.h:15
void ipa_prepend_header_ext(struct msgb *msg, int proto)
Definition: ipa.c:433
int ipa_ccm_tlv_to_unitdata(struct ipaccess_unit *ud, const struct tlv_parsed *tp)
Definition: ipa.c:173
int ipa_ccm_send_pong(int fd)
Definition: ipa.c:355
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
int ipa_send(int fd, const void *msg, size_t msglen)
Definition: ipa.c:341
uint16_t site_id
Definition: ipa.h:14
int ipa_ccm_send_id_ack(int fd)
Definition: ipa.c:360
uint8_t mac_addr[6]
Definition: ipa.h:20
int ipa_ccm_idtag_parse_off(struct tlv_parsed *dec, unsigned char *buf, int len, const int len_offset)
Definition: ipa.c:106
int ipa_msg_recv_buffered(int fd, struct msgb **rmsg, struct msgb **tmp_msg)
char * unit_name
Definition: ipa.h:17
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
void ipa_prepend_header(struct msgb *msg, int proto)
Definition: ipa.c:442
char * location2
Definition: ipa.h:22
char * location1
Definition: ipa.h:21
uint8_t len
Definition: gsm_04_11.h:497
const char * ipa_ccm_idtag_name(uint8_t tag)
Definition: ipa.c:93
char * swversion
Definition: ipa.h:19
result of the TLV parser
Definition: tlv.h:424
struct msgb * ipa_msg_alloc(int headroom)
Definition: ipa.c:586
char * equipvers
Definition: ipa.h:18
int ipa_ccm_send_id_req(int fd)
Definition: ipa.c:365
Definition: ipa.h:13
int ipa_ccm_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd)
Definition: ipa.c:371
int ipa_ccm_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len)
Definition: ipa.c:101
uint16_t trx_id
Definition: ipa.h:16
int ipa_ccm_rcvmsg_bts_base(struct msgb *msg, struct osmo_fd *bfd)
Definition: ipa.c:409
uint8_t data[0]
message payload data
Definition: gsm_03_41.h:109
uint8_t proto
Definition: ipaccess.h:834
char * serno
Definition: ipa.h:23