sccp_helpers.c File Reference
`#include <string.h>`
`#include <stdbool.h>`
`#include <sys/socket.h>`
`#include <arpa/inet.h>`
`#include <netinet/in.h>`
`#include <osmocom/sigtran/sccp_sap.h>`
`#include <osmocom/sigtran/sccp_helpers.h>`
`#include "sccp_internal.h"`

## Macros

#define | SCU_MSG_SIZE 2048
#define | SCU_MSG_HEADROOM 512

## Functions

static struct msgb * | scu_msgb_alloc (const char *name)
void | osmo_sccp_make_addr_pc_ssn (struct osmo_sccp_addr *addr, uint32_t pc, uint32_t ssn)
void | osmo_sccp_addr_set_ssn (struct osmo_sccp_addr *addr, uint32_t ssn)
int | osmo_sccp_tx_unitdata (struct osmo_sccp_user *scu, const struct osmo_sccp_addr *calling_addr, const struct osmo_sccp_addr *called_addr, const uint8_t *data, unsigned int len)
int | osmo_sccp_tx_unitdata_ranap (struct osmo_sccp_user *scu, uint32_t src_point_code, uint32_t dst_point_code, const uint8_t *data, unsigned int len)
int | osmo_sccp_tx_unitdata_msg (struct osmo_sccp_user *scu, const struct osmo_sccp_addr *calling_addr, const struct osmo_sccp_addr *called_addr, struct msgb *msg)
int | osmo_sccp_tx_conn_req (struct osmo_sccp_user *scu, uint32_t conn_id, const struct osmo_sccp_addr *calling_addr, const struct osmo_sccp_addr *called_addr, const uint8_t *data, unsigned int len)
int | osmo_sccp_tx_conn_req_msg (struct osmo_sccp_user *scu, uint32_t conn_id, const struct osmo_sccp_addr *calling_addr, const struct osmo_sccp_addr *called_addr, struct msgb *msg)
int | osmo_sccp_tx_data (struct osmo_sccp_user *scu, uint32_t conn_id, const uint8_t *data, unsigned int len)
int | osmo_sccp_tx_data_msg (struct osmo_sccp_user *scu, uint32_t conn_id, struct msgb *msg)
int | osmo_sccp_tx_disconn (struct osmo_sccp_user *scu, uint32_t conn_id, const struct osmo_sccp_addr *resp_addr, uint32_t cause)
int | osmo_sccp_tx_conn_resp_msg (struct osmo_sccp_user *scu, uint32_t conn_id, const struct osmo_sccp_addr *resp_addr, struct msgb *msg)
int | osmo_sccp_tx_conn_resp (struct osmo_sccp_user *scu, uint32_t conn_id, const struct osmo_sccp_addr *resp_addr, const uint8_t *data, unsigned int len)
static void | append_to_buf (char *buf, size_t size, bool *comma, const char *fmt,...)
char * | osmo_sccp_gt_dump (const struct osmo_sccp_gt *gt)
char * | osmo_sccp_addr_dump (const struct osmo_sccp_addr *addr)
char * | osmo_sccp_addr_name (const struct osmo_ss7_instance *ss7, const struct osmo_sccp_addr *addr)
char * | osmo_sccp_inst_addr_name (const struct osmo_sccp_instance *sccp, const struct osmo_sccp_addr *addr)

## Macro Definition Documentation

## SCU_MSG_HEADROOM

#define SCU_MSG_HEADROOM 512

Referenced by scu_msgb_alloc().

## SCU_MSG_SIZE

#define SCU_MSG_SIZE 2048

Referenced by scu_msgb_alloc().

## Function Documentation

## append_to_buf()

static void append_to_buf | ( | char * | buf,
|  | size_t | size,
|  | bool * | comma,
|  | const char * | fmt,
|  |  | ...
| ) |  |

static

Referenced by osmo_sccp_addr_dump(), osmo_sccp_addr_name(), and osmo_sccp_gt_dump().

## osmo_sccp_addr_dump()

char* osmo_sccp_addr_dump | ( | const struct osmo_sccp_addr * | addr | ) |

References append_to_buf(), osmo_sccp_addr::gt, osmo_sccp_gt::gti, osmo_sccp_addr::ip, OSMO_SCCP_ADDR_T_GT, OSMO_SCCP_ADDR_T_IPv4, OSMO_SCCP_ADDR_T_PC, OSMO_SCCP_ADDR_T_SSN, osmo_sccp_gt_dump(), OSMO_SCCP_GTI_NO_GT, osmo_sccp_addr::pc, osmo_sccp_addr::presence, osmo_sccp_addr::ri, osmo_sccp_addr::ssn, and osmo_sccp_addr::v4.

Referenced by gen_mtp_transfer_req_xua(), and sccp_addr_to_sua().

## osmo_sccp_addr_name()

char* osmo_sccp_addr_name | ( | const struct osmo_ss7_instance * | ss7,
|  | const struct osmo_sccp_addr * | addr
| ) |  |

References append_to_buf(), osmo_sccp_addr::gt, osmo_sccp_gt::gti, osmo_sccp_addr::ip, OSMO_SCCP_ADDR_T_GT, OSMO_SCCP_ADDR_T_IPv4, OSMO_SCCP_ADDR_T_PC, OSMO_SCCP_ADDR_T_SSN, osmo_sccp_gt_dump(), osmo_sccp_gti_name(), OSMO_SCCP_GTI_NO_GT, osmo_sccp_routing_ind_name(), osmo_sccp_ssn_name(), osmo_ss7_pointcode_print(), osmo_sccp_addr::pc, osmo_sccp_addr::presence, osmo_sccp_addr::ri, osmo_sccp_addr::ssn, and osmo_sccp_addr::v4.

Referenced by osmo_sccp_inst_addr_name(), and osmo_sccp_user_name().

## osmo_sccp_addr_set_ssn()

void osmo_sccp_addr_set_ssn | ( | struct osmo_sccp_addr * | addr,
|  | uint32_t | ssn
| ) |  |

References OSMO_SCCP_ADDR_T_SSN, osmo_sccp_addr::presence, and osmo_sccp_addr::ssn.

## osmo_sccp_gt_dump()

char* osmo_sccp_gt_dump | ( | const struct osmo_sccp_gt * | gt | ) |

References append_to_buf(), osmo_sccp_gt::digits, osmo_sccp_gt::gti, osmo_sccp_gt::nai, osmo_sccp_gt::npi, OSMO_SCCP_GTI_NAI_ONLY, OSMO_SCCP_GTI_NO_GT, OSMO_SCCP_GTI_TT_NPL_ENC, OSMO_SCCP_GTI_TT_NPL_ENC_NAI, OSMO_SCCP_GTI_TT_ONLY, and osmo_sccp_gt::tt.

Referenced by osmo_sccp_addr_dump(), and osmo_sccp_addr_name().

## osmo_sccp_inst_addr_name()

char* osmo_sccp_inst_addr_name | ( | const struct osmo_sccp_instance * | sccp,
|  | const struct osmo_sccp_addr * | addr
| ) |  |

References osmo_sccp_addr_name(), and osmo_sccp_instance::ss7.

## osmo_sccp_make_addr_pc_ssn()

void osmo_sccp_make_addr_pc_ssn | ( | struct osmo_sccp_addr * | addr,
|  | uint32_t | pc,
|  | uint32_t | ssn
| ) |  |

References OSMO_SCCP_ADDR_T_PC, OSMO_SCCP_ADDR_T_SSN, OSMO_SCCP_RI_SSN_PC, osmo_sccp_addr::pc, osmo_sccp_addr::presence, and osmo_sccp_addr::ssn.

Referenced by osmo_sccp_local_addr_by_instance(), osmo_sccp_tx_unitdata_ranap(), and osmo_sccp_user_name().

## osmo_sccp_tx_conn_req()

int osmo_sccp_tx_conn_req | ( | struct osmo_sccp_user * | scu,
|  | uint32_t | conn_id,
|  | const struct osmo_sccp_addr * | calling_addr,
|  | const struct osmo_sccp_addr * | called_addr,
|  | const uint8_t * | data,
|  | unsigned int | len
| ) |  |

References osmo_scu_connect_param::called_addr, osmo_scu_connect_param::calling_addr, osmo_scu_connect_param::conn_id, osmo_scu_prim::connect, osmo_scu_prim::oph, osmo_sccp_user_sap_down(), OSMO_SCU_PRIM_N_CONNECT, osmo_scu_connect_param::sccp_class, SCCP_SAP_USER, scu_msgb_alloc(), and osmo_scu_prim::u.

Referenced by osmo_sccp_tx_conn_req_msg().

## osmo_sccp_tx_conn_req_msg()

int osmo_sccp_tx_conn_req_msg | ( | struct osmo_sccp_user * | scu,
|  | uint32_t | conn_id,
|  | const struct osmo_sccp_addr * | calling_addr,
|  | const struct osmo_sccp_addr * | called_addr,
|  | struct msgb * | msg
| ) |  |

References osmo_sccp_tx_conn_req().

## osmo_sccp_tx_conn_resp()

int osmo_sccp_tx_conn_resp | ( | struct osmo_sccp_user * | scu,
|  | uint32_t | conn_id,
|  | const struct osmo_sccp_addr * | resp_addr,
|  | const uint8_t * | data,
|  | unsigned int | len
| ) |  |

References osmo_sccp_tx_conn_resp_msg(), and scu_msgb_alloc().

## osmo_sccp_tx_conn_resp_msg()

int osmo_sccp_tx_conn_resp_msg | ( | struct osmo_sccp_user * | scu,
|  | uint32_t | conn_id,
|  | const struct osmo_sccp_addr * | resp_addr,
|  | struct msgb * | msg
| ) |  |

References osmo_scu_connect_param::conn_id, osmo_scu_prim::connect, osmo_scu_prim::oph, osmo_sccp_user_sap_down(), OSMO_SCU_PRIM_N_CONNECT, osmo_scu_connect_param::responding_addr, osmo_scu_connect_param::sccp_class, SCCP_SAP_USER, and osmo_scu_prim::u.

Referenced by osmo_sccp_tx_conn_resp().

## osmo_sccp_tx_data()

int osmo_sccp_tx_data | ( | struct osmo_sccp_user * | scu,
|  | uint32_t | conn_id,
|  | const uint8_t * | data,
|  | unsigned int | len
| ) |  |

References osmo_scu_data_param::conn_id, osmo_scu_prim::data, osmo_scu_prim::oph, osmo_sccp_user_sap_down(), OSMO_SCU_PRIM_N_DATA, SCCP_SAP_USER, scu_msgb_alloc(), and osmo_scu_prim::u.

Referenced by osmo_sccp_tx_data_msg().

## osmo_sccp_tx_data_msg()

int osmo_sccp_tx_data_msg | ( | struct osmo_sccp_user * | scu,
|  | uint32_t | conn_id,
|  | struct msgb * | msg
| ) |  |

References osmo_sccp_tx_data().

## osmo_sccp_tx_disconn()

int osmo_sccp_tx_disconn | ( | struct osmo_sccp_user * | scu,
|  | uint32_t | conn_id,
|  | const struct osmo_sccp_addr * | resp_addr,
|  | uint32_t | cause
| ) |  |

References osmo_scu_disconn_param::cause, osmo_scu_disconn_param::conn_id, osmo_scu_prim::disconnect, osmo_scu_prim::oph, osmo_scu_disconn_param::originator, OSMO_SCCP_ORIG_NS_USER, osmo_sccp_user_sap_down(), OSMO_SCU_PRIM_N_DISCONNECT, osmo_scu_disconn_param::responding_addr, SCCP_SAP_USER, scu_msgb_alloc(), and osmo_scu_prim::u.

## osmo_sccp_tx_unitdata()

int osmo_sccp_tx_unitdata | ( | struct osmo_sccp_user * | scu,
|  | const struct osmo_sccp_addr * | calling_addr,
|  | const struct osmo_sccp_addr * | called_addr,
|  | const uint8_t * | data,
|  | unsigned int | len
| ) |  |

References osmo_scu_unitdata_param::called_addr, osmo_scu_unitdata_param::calling_addr, osmo_scu_prim::oph, osmo_sccp_user_sap_down(), OSMO_SCU_PRIM_N_UNITDATA, SCCP_SAP_USER, scu_msgb_alloc(), osmo_scu_prim::u, and osmo_scu_prim::unitdata.

Referenced by osmo_sccp_tx_unitdata_msg(), and osmo_sccp_tx_unitdata_ranap().

## osmo_sccp_tx_unitdata_msg()

int osmo_sccp_tx_unitdata_msg | ( | struct osmo_sccp_user * | scu,
|  | const struct osmo_sccp_addr * | calling_addr,
|  | const struct osmo_sccp_addr * | called_addr,
|  | struct msgb * | msg
| ) |  |

References osmo_sccp_tx_unitdata().

## osmo_sccp_tx_unitdata_ranap()

int osmo_sccp_tx_unitdata_ranap | ( | struct osmo_sccp_user * | scu,
|  | uint32_t | src_point_code,
|  | uint32_t | dst_point_code,
|  | const uint8_t * | data,
|  | unsigned int | len
| ) |  |

References osmo_sccp_make_addr_pc_ssn(), OSMO_SCCP_SSN_RANAP, and osmo_sccp_tx_unitdata().

## scu_msgb_alloc()

static struct msgb* scu_msgb_alloc | ( | const char * | name | ) |

static

References SCU_MSG_HEADROOM, and SCU_MSG_SIZE.

Referenced by osmo_sccp_tx_conn_req(), osmo_sccp_tx_conn_resp(), osmo_sccp_tx_data(), osmo_sccp_tx_disconn(), and osmo_sccp_tx_unitdata().