aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2014-08-20 22:06:04 +0200
committerHarald Welte <laforge@gnumonks.org>2014-08-20 23:16:34 +0200
commit28aa991c2fa8c27a3100530bf9d7ab5d592f4792 (patch)
treeb2b7eb16c8c4679bbeb31fae562d34f8fbee0b9d /include
parentfe3e42bdcbaa3bcb336227b8d2a7aad73c636047 (diff)
import various generic IPA related functions from libosmo-abis
libosmo-abis is about forming A-bis interfaces/lines by means of E1 or the IPA multiplex (or possibly other link layers). The IPA multiplex is used in other contexts, such as the Control interface, or the A interface. In that context, it makes sense to have generic IPA related functions in libosmocore.
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am1
-rw-r--r--include/osmocom/gsm/ipaccess.h62
2 files changed, 63 insertions, 0 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 3046758a..3b35b7b4 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -58,6 +58,7 @@ nobase_include_HEADERS = \
osmocom/gsm/gsm48.h \
osmocom/gsm/gsm48_ie.h \
osmocom/gsm/gsm_utils.h \
+ osmocom/gsm/ipaccess.h \
osmocom/gsm/lapd_core.h \
osmocom/gsm/lapdm.h \
osmocom/gsm/meas_rep.h \
diff --git a/include/osmocom/gsm/ipaccess.h b/include/osmocom/gsm/ipaccess.h
new file mode 100644
index 00000000..dd560698
--- /dev/null
+++ b/include/osmocom/gsm/ipaccess.h
@@ -0,0 +1,62 @@
+#pragma once
+
+#include <stdint.h>
+
+#include <osmocom/core/msgb.h>
+#include <osmocom/gsm/tlv.h>
+
+/* 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 *ipaccess_idtag_name(uint8_t tag);
+
+/* parse a buffer of ID tags into a osmocom TLV style representation */
+int ipaccess_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len);
+
+/* parse an Unit ID in string format into the 'ipaccess_unit' data structure */
+int ipaccess_parse_unitid(const char *str, struct ipaccess_unit *unit_data);
+
+/* fill a 'struct ipaccess_unit' based on a parsed IDTAG TLV */
+int ipaccess_tlv_to_unitdata(struct ipaccess_unit *ud,
+ const struct tlv_parsed *tp);
+
+/* Send an IPA message to the given FD */
+int ipaccess_send(int fd, const void *msg, size_t msglen);
+
+/* Send an IPA CCM PONG via the given FD */
+int ipaccess_send_pong(int fd);
+
+/* Send an IPA CCM ID_ACK via the given FD */
+int ipaccess_send_id_ack(int fd);
+
+/* Send an IPA CCM ID_REQ via the given FD */
+int ipaccess_send_id_req(int fd);
+
+/* Common handling of IPA CCM, BSC side */
+int ipaccess_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd);
+
+/* Common handling of IPA CCM, BTS side */
+int ipaccess_rcvmsg_bts_base(struct msgb *msg, struct osmo_fd *bfd);
+
+/* prepend (push) an ipaccess_head_ext to the msgb */
+void ipaccess_prepend_header_ext(struct msgb *msg, int proto);
+
+/* prepend (push) an ipaccess_head to the msgb */
+void ipaccess_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);