ipa: rename functions for consistency

As we are breaking builds by moving functions from libosmo-abis to
libosmocore anyway, we might as well give functions more appropriate
names.  ipaccess is a company, while IPA is the multiplex protocol, and
CCM is the protocol used for establishing identities on the IPA
multiplex.
This commit is contained in:
Harald Welte 2014-08-20 22:28:23 +02:00
parent 28aa991c2f
commit e391996947
5 changed files with 52 additions and 37 deletions

View File

@ -58,7 +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/ipa.h \
osmocom/gsm/lapd_core.h \
osmocom/gsm/lapdm.h \
osmocom/gsm/meas_rep.h \

View File

@ -20,41 +20,41 @@ struct ipaccess_unit {
};
/* obtain the human-readable name of an IPA CCM ID TAG */
const char *ipaccess_idtag_name(uint8_t tag);
const char *ipa_ccm_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);
int ipa_ccm_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);
int ipa_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,
int ipa_ccm_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);
int ipa_send(int fd, const void *msg, size_t msglen);
/* Send an IPA CCM PONG via the given FD */
int ipaccess_send_pong(int fd);
int ipa_ccm_send_pong(int fd);
/* Send an IPA CCM ID_ACK via the given FD */
int ipaccess_send_id_ack(int fd);
int ipa_ccm_send_id_ack(int fd);
/* Send an IPA CCM ID_REQ via the given FD */
int ipaccess_send_id_req(int fd);
int ipa_ccm_send_id_req(int fd);
/* Common handling of IPA CCM, BSC side */
int ipaccess_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd);
int ipa_ccm_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);
int ipa_ccm_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);
void ipa_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);
void ipa_prepend_header(struct msgb *msg, int proto);
struct msgb *ipa_msg_alloc(int headroom);

View File

@ -19,7 +19,7 @@ libosmogsm_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \
auth_core.c auth_comp128v1.c auth_comp128v23.c \
auth_milenage.c milenage/aes-encblock.c \
milenage/aes-internal.c milenage/aes-internal-enc.c \
milenage/milenage.c gan.c ipaccess.c
milenage/milenage.c gan.c ipa.c
libosmogsm_la_LDFLAGS = $(LTLDFLAGS_OSMOGSM) -version-info $(LIBVERSION) -no-undefined
libosmogsm_la_LIBADD = $(top_builddir)/src/libosmocore.la

View File

@ -36,7 +36,7 @@
#include <osmocom/gsm/tlv.h>
#include <osmocom/gsm/protocol/ipaccess.h>
#include <osmocom/gsm/ipaccess.h>
#include <osmocom/gsm/ipa.h>
#define IPA_ALLOC_SIZE 1200
@ -79,7 +79,7 @@ static const char *idtag_names[] = {
[IPAC_IDTAG_UNIT] = "Unit_ID",
};
const char *ipaccess_idtag_name(uint8_t tag)
const char *ipa_ccm_idtag_name(uint8_t tag)
{
if (tag >= ARRAY_SIZE(idtag_names))
return "unknown";
@ -87,7 +87,7 @@ const char *ipaccess_idtag_name(uint8_t tag)
return idtag_names[tag];
}
int ipaccess_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len)
int ipa_ccm_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len)
{
uint8_t t_len;
uint8_t t_tag;
@ -105,7 +105,7 @@ int ipaccess_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len)
return -EINVAL;
}
DEBUGPC(DLMI, "%s='%s' ", ipaccess_idtag_name(t_tag), cur);
DEBUGPC(DLMI, "%s='%s' ", ipa_ccm_idtag_name(t_tag), cur);
dec->lv[t_tag].len = t_len;
dec->lv[t_tag].val = cur;
@ -116,7 +116,7 @@ int ipaccess_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len)
return 0;
}
int ipaccess_parse_unitid(const char *str, struct ipaccess_unit *unit_data)
int ipa_parse_unitid(const char *str, struct ipaccess_unit *unit_data)
{
unsigned long ul;
char *endptr;
@ -149,7 +149,7 @@ int ipaccess_parse_unitid(const char *str, struct ipaccess_unit *unit_data)
return 0;
}
int ipaccess_tlv_to_unitdata(struct ipaccess_unit *ud,
int ipa_ccm_tlv_to_unitdata(struct ipaccess_unit *ud,
const struct tlv_parsed *tp)
{
int rc = 0;
@ -186,14 +186,14 @@ int ipaccess_tlv_to_unitdata(struct ipaccess_unit *ud,
}
if (TLVP_PRES_LEN(tp, IPAC_IDTAG_UNIT, 1))
rc = ipaccess_parse_unitid((char *)
rc = ipa_parse_unitid((char *)
TLVP_VAL(tp, IPAC_IDTAG_UNIT), ud);
out:
return rc;
}
int ipaccess_send(int fd, const void *msg, size_t msglen)
int ipa_send(int fd, const void *msg, size_t msglen)
{
int ret;
@ -201,36 +201,36 @@ int ipaccess_send(int fd, const void *msg, size_t msglen)
if (ret < 0)
return ret;
if (ret < msglen) {
LOGP(DLINP, LOGL_ERROR, "ipaccess_send: short write\n");
LOGP(DLINP, LOGL_ERROR, "ipa_send: short write\n");
return -EIO;
}
return ret;
}
int ipaccess_send_pong(int fd)
int ipa_ccm_send_pong(int fd)
{
return ipaccess_send(fd, ipa_pong_msg, sizeof(ipa_pong_msg));
return ipa_send(fd, ipa_pong_msg, sizeof(ipa_pong_msg));
}
int ipaccess_send_id_ack(int fd)
int ipa_ccm_send_id_ack(int fd)
{
return ipaccess_send(fd, ipa_id_ack_msg, sizeof(ipa_id_ack_msg));
return ipa_send(fd, ipa_id_ack_msg, sizeof(ipa_id_ack_msg));
}
int ipaccess_send_id_req(int fd)
int ipa_ccm_send_id_req(int fd)
{
return ipaccess_send(fd, ipa_id_req_msg, sizeof(ipa_id_req_msg));
return ipa_send(fd, ipa_id_req_msg, sizeof(ipa_id_req_msg));
}
/* base handling of the ip.access protocol */
int ipaccess_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd)
int ipa_ccm_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd)
{
uint8_t msg_type = *(msg->l2h);
int ret;
switch (msg_type) {
case IPAC_MSGT_PING:
ret = ipaccess_send_pong(bfd->fd);
ret = ipa_ccm_send_pong(bfd->fd);
if (ret < 0) {
LOGP(DLINP, LOGL_ERROR, "Cannot send PING "
"message. Reason: %s\n", strerror(errno));
@ -244,7 +244,7 @@ int ipaccess_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd)
break;
case IPAC_MSGT_ID_ACK:
DEBUGP(DLMI, "ID_ACK? -> ACK!\n");
ret = ipaccess_send_id_ack(bfd->fd);
ret = ipa_ccm_send_id_ack(bfd->fd);
if (ret < 0) {
LOGP(DLINP, LOGL_ERROR, "Cannot send ID_ACK "
"message. Reason: %s\n", strerror(errno));
@ -261,15 +261,14 @@ int ipaccess_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd)
}
/* base handling of the ip.access protocol */
int ipaccess_rcvmsg_bts_base(struct msgb *msg,
struct osmo_fd *bfd)
int ipa_ccm_rcvmsg_bts_base(struct msgb *msg, struct osmo_fd *bfd)
{
uint8_t msg_type = *(msg->l2h);
int ret = 0;
switch (msg_type) {
case IPAC_MSGT_PING:
ret = ipaccess_send_pong(bfd->fd);
ret = ipa_ccm_send_pong(bfd->fd);
if (ret < 0) {
LOGP(DLINP, LOGL_ERROR, "Cannot send PONG "
"message. Reason: %s\n", strerror(errno));
@ -286,7 +285,7 @@ int ipaccess_rcvmsg_bts_base(struct msgb *msg,
}
void ipaccess_prepend_header_ext(struct msgb *msg, int proto)
void ipa_prepend_header_ext(struct msgb *msg, int proto)
{
struct ipaccess_head_ext *hh_ext;
@ -295,7 +294,7 @@ void ipaccess_prepend_header_ext(struct msgb *msg, int proto)
hh_ext->proto = proto;
}
void ipaccess_prepend_header(struct msgb *msg, int proto)
void ipa_prepend_header(struct msgb *msg, int proto)
{
struct ipaccess_head *hh;

View File

@ -246,5 +246,21 @@ vtvlv_gan_att_def;
gan_msgt_vals;
gan_pdisc_vals;
ipa_ccm_rcvmsg_base;
ipa_ccm_rcvmsg_bts_base;
ipa_ccm_send_id_ack;
ipa_ccm_send_id_req;
ipa_ccm_send_pong;
ipa_ccm_tlv_to_unitdata;
ipa_ccm_idtag_name;
ipa_ccm_idtag_parse;
ipa_msg_alloc;
ipa_msg_recv;
ipa_msg_recv_buffered;
ipa_parse_unitid;
ipa_prepend_header;
ipa_prepend_header_ext;
ipa_send;
local: *;
};