blob: dd560698b1332f3a1e74310b719f11f34b439203 [file] [log] [blame]
Harald Welte28aa9912014-08-20 22:06:04 +02001#pragma once
2
3#include <stdint.h>
4
5#include <osmocom/core/msgb.h>
6#include <osmocom/gsm/tlv.h>
7
8/* internal (host-only) data structure */
9struct ipaccess_unit {
10 uint16_t site_id;
11 uint16_t bts_id;
12 uint16_t trx_id;
13 char *unit_name;
14 char *equipvers;
15 char *swversion;
16 uint8_t mac_addr[6];
17 char *location1;
18 char *location2;
19 char *serno;
20};
21
22/* obtain the human-readable name of an IPA CCM ID TAG */
23const char *ipaccess_idtag_name(uint8_t tag);
24
25/* parse a buffer of ID tags into a osmocom TLV style representation */
26int ipaccess_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len);
27
28/* parse an Unit ID in string format into the 'ipaccess_unit' data structure */
29int ipaccess_parse_unitid(const char *str, struct ipaccess_unit *unit_data);
30
31/* fill a 'struct ipaccess_unit' based on a parsed IDTAG TLV */
32int ipaccess_tlv_to_unitdata(struct ipaccess_unit *ud,
33 const struct tlv_parsed *tp);
34
35/* Send an IPA message to the given FD */
36int ipaccess_send(int fd, const void *msg, size_t msglen);
37
38/* Send an IPA CCM PONG via the given FD */
39int ipaccess_send_pong(int fd);
40
41/* Send an IPA CCM ID_ACK via the given FD */
42int ipaccess_send_id_ack(int fd);
43
44/* Send an IPA CCM ID_REQ via the given FD */
45int ipaccess_send_id_req(int fd);
46
47/* Common handling of IPA CCM, BSC side */
48int ipaccess_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd);
49
50/* Common handling of IPA CCM, BTS side */
51int ipaccess_rcvmsg_bts_base(struct msgb *msg, struct osmo_fd *bfd);
52
53/* prepend (push) an ipaccess_head_ext to the msgb */
54void ipaccess_prepend_header_ext(struct msgb *msg, int proto);
55
56/* prepend (push) an ipaccess_head to the msgb */
57void ipaccess_prepend_header(struct msgb *msg, int proto);
58
59struct msgb *ipa_msg_alloc(int headroom);
60
61int ipa_msg_recv(int fd, struct msgb **rmsg);
62int ipa_msg_recv_buffered(int fd, struct msgb **rmsg, struct msgb **tmp_msg);