Loading...
Searching...
No Matches
Ipa

IPA Multiplex utility routines. More...

## Macros

#define | IPA_ALLOC_SIZE 1200
#define | IPA_STRING_MAX 64

## Functions

const char * | ipa_ccm_idtag_name (uint8_t tag)
int | ipa_ccm_idtag_parse (struct tlv_parsed *dec, unsigned char *buf, int len)
| Parse the payload part of an IPA CCM ID GET, return tlv_parsed format.
int | ipa_ccm_idtag_parse_off (struct tlv_parsed *dec, unsigned char *buf, int len, const int len_offset)
| Parse the payload part of an IPA CCM ID GET, return tlv_parsed format.
int | ipa_ccm_id_get_parse (struct tlv_parsed *dec, const uint8_t *buf, unsigned int len)
| Parse the payload part of an IPA CCM ID GET, return tlv_parsed format.
int | ipa_ccm_id_resp_parse (struct tlv_parsed *dec, const uint8_t *buf, unsigned int len)
| Parse the payload part of an IPA CCM ID RESP, return tlv_parsed format.
int | ipa_parse_unitid (const char *str, struct ipaccess_unit *unit_data)
int | ipa_ccm_tlv_to_unitdata (struct ipaccess_unit *ud, const struct tlv_parsed *tp)
struct msgb * | ipa_ccm_make_id_resp (const struct ipaccess_unit *dev, const uint8_t *ies_req, unsigned int num_ies_req)
| Generate IPA CCM ID RESP based on list of IEs.
struct msgb * | ipa_ccm_make_id_resp_from_req (const struct ipaccess_unit *dev, const uint8_t *data, unsigned int len)
| Generate IPA CCM ID RESP based on requets payload.
int | ipa_send (int fd, const void *msg, size_t msglen)
int | ipa_ccm_send_pong (int fd)
int | ipa_ccm_send_id_ack (int fd)
int | ipa_ccm_send_id_req (int fd)
int | ipa_ccm_rcvmsg_base (struct msgb *msg, struct osmo_fd *bfd)
int | ipa_ccm_rcvmsg_bts_base (struct msgb *msg, struct osmo_fd *bfd)
void | ipa_prepend_header_ext (struct msgb *msg, int proto)
void | ipa_prepend_header (struct msgb *msg, int proto)
struct msgb * | ipa_msg_alloc (int headroom)

## Variables

static const uint8_t | ipa_pong_msg []
static const uint8_t | ipa_id_ack_msg []
static const uint8_t | ipa_id_req_msg []
static const char * | idtag_names []

## Detailed Description

IPA Multiplex utility routines.

## Macro Definition Documentation

## IPA_ALLOC_SIZE

#define IPA_ALLOC_SIZE 1200

## IPA_STRING_MAX

#define IPA_STRING_MAX 64

## Function Documentation

## ipa_ccm_id_get_parse()

int ipa_ccm_id_get_parse | ( | struct tlv_parsed * | dec,
|  | const uint8_t * | buf,
|  | unsigned int | len
| ) |  |

Parse the payload part of an IPA CCM ID GET, return tlv_parsed format.

The odd payload format of those messages is structured as follows:

- 8bit length value (length of payload and tag)
- 8bit tag value
- optional, variable-length payload
  Parameters

    [out] | dec | Caller-provided/allocated output structure for parsed payload
    [in] | buf | Buffer containing the payload (excluding 1 byte msg_type) of the message
    [in] | len | Length of buf in octets

  Returns
    0 on success; negative on error

References DLMI, ipa_ccm_idtag_name(), len, LOGL_DEBUG, LOGL_ERROR, LOGP, and LOGPC.

## ipa_ccm_id_resp_parse()

int ipa_ccm_id_resp_parse | ( | struct tlv_parsed * | dec,
|  | const uint8_t * | buf,
|  | unsigned int | len
| ) |  |

Parse the payload part of an IPA CCM ID RESP, return tlv_parsed format.

The odd payload format of those messages is structured as follows:

- 16bit length value (length of payload and tag)
- 8bit tag value
- optional, variable-length payload
  Parameters

    [out] | dec | Caller-provided/allocated output structure for parsed payload
    [in] | buf | Buffer containing the payload (excluding 1 byte msg_type) of the message
    [in] | len | Length of buf in octets

  Returns
    0 on success; negative on error

References DEBUGPC, DLMI, ipa_ccm_idtag_name(), len, LOGL_DEBUG, LOGL_ERROR, LOGP, and LOGPC.

## ipa_ccm_idtag_name()

const char * ipa_ccm_idtag_name | ( | uint8_t | tag | ) |

References ARRAY_SIZE, and idtag_names.

Referenced by ipa_ccm_id_get_parse(), ipa_ccm_id_resp_parse(), and ipa_ccm_idtag_parse_off().

## ipa_ccm_idtag_parse()

int ipa_ccm_idtag_parse | ( | struct tlv_parsed * | dec,
|  | unsigned char * | buf,
|  | int | len
| ) |  |

Parse the payload part of an IPA CCM ID GET, return tlv_parsed format.

References ipa_ccm_idtag_parse_off(), and len.

## ipa_ccm_idtag_parse_off()

int ipa_ccm_idtag_parse_off | ( | struct tlv_parsed * | dec,
|  | unsigned char * | buf,
|  | int | len,
|  | const int | len_offset
| ) |  |

Parse the payload part of an IPA CCM ID GET, return tlv_parsed format.

WARNING: This function can only parse correctly IPA CCM ID GET/REQUEST messages, and only when len_offset is passed value of 1.

Parameters

  [out] | dec | Caller-provided/allocated output structure for parsed payload
  [in] | buf | Buffer containing the payload (excluding 1 byte msg_type) of the message
  [in] | len | Length of buf in octets
  [in] | len_offset | Offset from end of len field to start of value (ommiting tag). Must be 1!

Returns
  0 on success; negative on error

References DLMI, ipa_ccm_idtag_name(), len, LOGL_DEBUG, LOGL_ERROR, LOGP, and LOGPC.

Referenced by ipa_ccm_idtag_parse().

## ipa_ccm_make_id_resp()

struct msgb * ipa_ccm_make_id_resp | ( | const struct ipaccess_unit * | dev,
|  | const uint8_t * | ies_req,
|  | unsigned int | num_ies_req
| ) |  |

Generate IPA CCM ID RESP based on list of IEs.

Parameters

  [in] | dev | Descriptor describing identity data for response
  [in] | ies_req | List of IEIs to include in response
  [in] | num_ies_req | Number of IEIs in ies_req

Returns
  Message buffer with IPA CCM ID RESP

References DLINP, ipa_msg_alloc(), ipa_prepend_header(), IPA_STRING_MAX, IPAC_IDTAG_EQUIPVERS, IPAC_IDTAG_LOCATION1, IPAC_IDTAG_LOCATION2, IPAC_IDTAG_MACADDR, IPAC_IDTAG_SERNR, IPAC_IDTAG_SWVERSION, IPAC_IDTAG_UNIT, IPAC_IDTAG_UNITNAME, IPAC_MSGT_ID_RESP, IPAC_PROTO_IPACCESS, len, LOGL_INFO, LOGL_NOTICE, LOGP, msg, msgb_free(), and osmo_strlcpy().

Referenced by ipa_ccm_make_id_resp_from_req().

## ipa_ccm_make_id_resp_from_req()

struct msgb * ipa_ccm_make_id_resp_from_req | ( | const struct ipaccess_unit * | dev,
|  | const uint8_t * | data,
|  | unsigned int | len
| ) |  |

Generate IPA CCM ID RESP based on requets payload.

Parameters

  [in] | dev | Descriptor describing identity data for response
  [in] | data | Payload of the IPA CCM ID GET request
  [in] | len | Length of data in octets

Returns
  Message buffer with IPA CCM ID RESP

References msgb::data, DLINP, ipa_ccm_make_id_resp(), len, LOGL_ERROR, and LOGP.

## ipa_ccm_rcvmsg_base()

int ipa_ccm_rcvmsg_base | ( | struct msgb * | msg,
|  | struct osmo_fd * | bfd
| ) |  |

References DEBUGP, DLINP, DLMI, osmo_fd::fd, ipa_ccm_send_id_ack(), ipa_ccm_send_pong(), IPAC_MSGT_ID_ACK, IPAC_MSGT_PING, IPAC_MSGT_PONG, len, LOGL_ERROR, LOGP, msg, and msg_type.

## ipa_ccm_rcvmsg_bts_base()

int ipa_ccm_rcvmsg_bts_base | ( | struct msgb * | msg,
|  | struct osmo_fd * | bfd
| ) |  |

References DEBUGP, DLINP, DLMI, osmo_fd::fd, ipa_ccm_send_pong(), IPAC_MSGT_ID_ACK, IPAC_MSGT_PING, IPAC_MSGT_PONG, len, LOGL_ERROR, LOGP, msg, and msg_type.

## ipa_ccm_send_id_ack()

int ipa_ccm_send_id_ack | ( | int | fd | ) |

References ipa_id_ack_msg, and ipa_send().

Referenced by ipa_ccm_rcvmsg_base().

## ipa_ccm_send_id_req()

int ipa_ccm_send_id_req | ( | int | fd | ) |

References ipa_id_req_msg, and ipa_send().

## ipa_ccm_send_pong()

int ipa_ccm_send_pong | ( | int | fd | ) |

References ipa_pong_msg, and ipa_send().

Referenced by ipa_ccm_rcvmsg_base(), and ipa_ccm_rcvmsg_bts_base().

## ipa_ccm_tlv_to_unitdata()

int ipa_ccm_tlv_to_unitdata | ( | struct ipaccess_unit * | ud,
|  | const struct tlv_parsed * | tp
| ) |  |

References ipa_parse_unitid(), IPAC_IDTAG_EQUIPVERS, IPAC_IDTAG_LOCATION1, IPAC_IDTAG_LOCATION2, IPAC_IDTAG_MACADDR, IPAC_IDTAG_SERNR, IPAC_IDTAG_SWVERSION, IPAC_IDTAG_UNIT, IPAC_IDTAG_UNITNAME, len, osmo_macaddr_parse(), TLVP_PRES_LEN, and TLVP_VAL.

## ipa_msg_alloc()

struct msgb * ipa_msg_alloc | ( | int | headroom | ) |

References len.

Referenced by ipa_ccm_make_id_resp().

## ipa_parse_unitid()

int ipa_parse_unitid | ( | const char * | str,
|  | struct ipaccess_unit * | unit_data
| ) |  |

References len.

Referenced by ipa_ccm_tlv_to_unitdata().

## ipa_prepend_header()

void ipa_prepend_header | ( | struct msgb * | msg,
|  | int | proto
| ) |  |

References len, ipaccess_head::len, msg, osmo_htons, and proto.

Referenced by ipa_ccm_make_id_resp().

## ipa_prepend_header_ext()

void ipa_prepend_header_ext | ( | struct msgb * | msg,
|  | int | proto
| ) |  |

References len, msg, proto, and ipaccess_head_ext::proto.

## ipa_send()

int ipa_send | ( | int | fd,
|  | const void * | msg,
|  | size_t | msglen
| ) |  |

References DLINP, len, LOGL_ERROR, LOGP, and msg.

Referenced by ipa_ccm_send_id_ack(), ipa_ccm_send_id_req(), and ipa_ccm_send_pong().

## Variable Documentation

## idtag_names

const char* idtag_names[]

static

Initial value:
= {
[IPAC_IDTAG_SERNR] = "Serial_Number",
[IPAC_IDTAG_UNITNAME] = "Unit_Name",
[IPAC_IDTAG_LOCATION1] = "Location_1",
[IPAC_IDTAG_LOCATION2] = "Location_2",
[IPAC_IDTAG_EQUIPVERS] = "Equipment_Version",
[IPAC_IDTAG_SWVERSION] = "Software_Version",
[IPAC_IDTAG_IPADDR] = "IP_Address",
[IPAC_IDTAG_MACADDR] = "MAC_Address",
[IPAC_IDTAG_UNIT] = "Unit_ID",
}
IPAC_IDTAG_EQUIPVERS
@ IPAC_IDTAG_EQUIPVERS
Definition ipaccess.h:66
IPAC_IDTAG_MACADDR
@ IPAC_IDTAG_MACADDR
Definition ipaccess.h:69
IPAC_IDTAG_UNIT
@ IPAC_IDTAG_UNIT
Definition ipaccess.h:70
IPAC_IDTAG_UNITNAME
@ IPAC_IDTAG_UNITNAME
Definition ipaccess.h:63
IPAC_IDTAG_SWVERSION
@ IPAC_IDTAG_SWVERSION
Definition ipaccess.h:67
IPAC_IDTAG_LOCATION2
@ IPAC_IDTAG_LOCATION2
Definition ipaccess.h:65
IPAC_IDTAG_LOCATION1
@ IPAC_IDTAG_LOCATION1
Definition ipaccess.h:64
IPAC_IDTAG_SERNR
@ IPAC_IDTAG_SERNR
Definition ipaccess.h:62
IPAC_IDTAG_IPADDR
@ IPAC_IDTAG_IPADDR
Definition ipaccess.h:68

Referenced by ipa_ccm_idtag_name().

## ipa_id_ack_msg

const uint8_t ipa_id_ack_msg[]

static

Initial value:
= {
0, 1, IPAC_PROTO_IPACCESS, IPAC_MSGT_ID_ACK
}
IPAC_MSGT_ID_ACK
@ IPAC_MSGT_ID_ACK
Definition ipaccess.h:50
IPAC_PROTO_IPACCESS
@ IPAC_PROTO_IPACCESS
Definition ipaccess.h:23

Referenced by ipa_ccm_send_id_ack().

## ipa_id_req_msg

const uint8_t ipa_id_req_msg[]

static

Initial value:
= {
0, 17, IPAC_PROTO_IPACCESS, IPAC_MSGT_ID_GET,
0x01, IPAC_IDTAG_UNIT,
0x01, IPAC_IDTAG_MACADDR,
0x01, IPAC_IDTAG_LOCATION1,
0x01, IPAC_IDTAG_LOCATION2,
0x01, IPAC_IDTAG_EQUIPVERS,
0x01, IPAC_IDTAG_SWVERSION,
0x01, IPAC_IDTAG_UNITNAME,
0x01, IPAC_IDTAG_SERNR,
}
IPAC_MSGT_ID_GET
@ IPAC_MSGT_ID_GET
Definition ipaccess.h:48

Referenced by ipa_ccm_send_id_req().

## ipa_pong_msg

const uint8_t ipa_pong_msg[]

static

Initial value:
= {
0, 1, IPAC_PROTO_IPACCESS, IPAC_MSGT_PONG
}
IPAC_MSGT_PONG
@ IPAC_MSGT_PONG
Definition ipaccess.h:47

Referenced by ipa_ccm_send_pong().