libosmogsm  0.11.0-dirty
Osmocom GSM library
include/osmocom/gsm/ipa.h
Go to the documentation of this file.
00001 
00003 #pragma once
00004 
00005 #include <stdint.h>
00006 
00007 #include <osmocom/core/msgb.h>
00008 #include <osmocom/gsm/tlv.h>
00009 
00010 struct osmo_fd;
00011 
00012 /* internal (host-only) data structure */
00013 struct ipaccess_unit {
00014         uint16_t site_id;
00015         uint16_t bts_id;
00016         uint16_t trx_id;
00017         char *unit_name;
00018         char *equipvers;
00019         char *swversion;
00020         uint8_t mac_addr[6];
00021         char *location1;
00022         char *location2;
00023         char *serno;
00024 };
00025 
00026 /* obtain the human-readable name of an IPA CCM ID TAG */
00027 const char *ipa_ccm_idtag_name(uint8_t tag);
00028 
00029 /* parse a buffer of ID tags into a osmocom TLV style representation */
00030 int ipa_ccm_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len);
00031 
00032 /* Is the TAG included in the length field? */
00033 int ipa_ccm_idtag_parse_off(struct tlv_parsed *dec, unsigned char *buf, int len, const int len_offset);
00034 
00035 /* parse an Unit ID in string format into the 'ipaccess_unit' data structure */
00036 int ipa_parse_unitid(const char *str, struct ipaccess_unit *unit_data);
00037 
00038 /* fill a 'struct ipaccess_unit' based on a parsed IDTAG TLV */
00039 int ipa_ccm_tlv_to_unitdata(struct ipaccess_unit *ud,
00040                              const struct tlv_parsed *tp);
00041 
00042 
00043 struct msgb *ipa_ccm_make_id_resp(const struct ipaccess_unit *dev,
00044                                   const uint8_t *ies_req, unsigned int num_ies_req);
00045 
00046 struct msgb *ipa_ccm_make_id_resp_from_req(const struct ipaccess_unit *dev,
00047                                            const uint8_t *data, unsigned int len);
00048 
00049 /* Send an IPA message to the given FD */
00050 int ipa_send(int fd, const void *msg, size_t msglen);
00051 
00052 /* Send an IPA CCM PONG via the given FD */
00053 int ipa_ccm_send_pong(int fd);
00054 
00055 /* Send an IPA CCM ID_ACK via the given FD */
00056 int ipa_ccm_send_id_ack(int fd);
00057 
00058 /* Send an IPA CCM ID_REQ via the given FD */
00059 int ipa_ccm_send_id_req(int fd);
00060 
00061 /* Common handling of IPA CCM, BSC side */
00062 int ipa_ccm_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd);
00063 
00064 /* Common handling of IPA CCM, BTS side */
00065 int ipa_ccm_rcvmsg_bts_base(struct msgb *msg, struct osmo_fd *bfd);
00066 
00067 /* prepend (push) an ipaccess_head_ext to the msgb */
00068 void ipa_prepend_header_ext(struct msgb *msg, int proto);
00069 
00070 /* prepend (push) an ipaccess_head to the msgb */
00071 void ipa_prepend_header(struct msgb *msg, int proto);
00072 
00073 struct msgb *ipa_msg_alloc(int headroom);
00074 
00075 int ipa_msg_recv(int fd, struct msgb **rmsg);
00076 int ipa_msg_recv_buffered(int fd, struct msgb **rmsg, struct msgb **tmp_msg);
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines