libosmogsm  0.9.6-9.20170220git32ee5af8.fc30
Osmocom GSM library
ipa.h
1 #pragma once
2 
3 #include <stdint.h>
4 
5 #include <osmocom/core/msgb.h>
6 #include <osmocom/gsm/tlv.h>
7 
8 struct osmo_fd;
9 
10 /* internal (host-only) data structure */
11 struct ipaccess_unit {
12  uint16_t site_id;
13  uint16_t bts_id;
14  uint16_t trx_id;
15  char *unit_name;
16  char *equipvers;
17  char *swversion;
18  uint8_t mac_addr[6];
19  char *location1;
20  char *location2;
21  char *serno;
22 };
23 
24 /* obtain the human-readable name of an IPA CCM ID TAG */
25 const char *ipa_ccm_idtag_name(uint8_t tag);
26 
27 /* parse a buffer of ID tags into a osmocom TLV style representation */
28 int ipa_ccm_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len);
29 
30 /* Is the TAG included in the length field? */
31 int ipa_ccm_idtag_parse_off(struct tlv_parsed *dec, unsigned char *buf, int len, const int len_offset);
32 
33 /* parse an Unit ID in string format into the 'ipaccess_unit' data structure */
34 int ipa_parse_unitid(const char *str, struct ipaccess_unit *unit_data);
35 
36 /* fill a 'struct ipaccess_unit' based on a parsed IDTAG TLV */
37 int ipa_ccm_tlv_to_unitdata(struct ipaccess_unit *ud,
38  const struct tlv_parsed *tp);
39 
40 /* Send an IPA message to the given FD */
41 int ipa_send(int fd, const void *msg, size_t msglen);
42 
43 /* Send an IPA CCM PONG via the given FD */
44 int ipa_ccm_send_pong(int fd);
45 
46 /* Send an IPA CCM ID_ACK via the given FD */
47 int ipa_ccm_send_id_ack(int fd);
48 
49 /* Send an IPA CCM ID_REQ via the given FD */
50 int ipa_ccm_send_id_req(int fd);
51 
52 /* Common handling of IPA CCM, BSC side */
53 int ipa_ccm_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd);
54 
55 /* Common handling of IPA CCM, BTS side */
56 int ipa_ccm_rcvmsg_bts_base(struct msgb *msg, struct osmo_fd *bfd);
57 
58 /* prepend (push) an ipaccess_head_ext to the msgb */
59 void ipa_prepend_header_ext(struct msgb *msg, int proto);
60 
61 /* prepend (push) an ipaccess_head to the msgb */
62 void ipa_prepend_header(struct msgb *msg, int proto);
63 
64 struct msgb *ipa_msg_alloc(int headroom);
65 
66 int ipa_msg_recv(int fd, struct msgb **rmsg);
67 int ipa_msg_recv_buffered(int fd, struct msgb **rmsg, struct msgb **tmp_msg);
result of the TLV parser
Definition: tlv.h:393
Definition: ipa.h:11