libosmo-sigtran  1.9.0.4-dc82
Osmocom SIGTRAN library
sccp_helpers.c File Reference
#include <errno.h>
#include <string.h>
#include <stdbool.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <osmocom/sccp/sccp_types.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_data (struct osmo_sccp_user *scu, uint32_t conn_id, const struct osmo_sccp_addr *resp_addr, uint32_t cause, const uint8_t *data, size_t len)
 
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)
 
static int sccp_addr_to_str_buf (char *buf, size_t buf_len, const struct osmo_ss7_instance *ss7, const struct osmo_sccp_addr *addr, char sep_char)
 
int osmo_sccp_addr_to_str_buf (char *buf, size_t buf_len, const struct osmo_ss7_instance *ss7, const struct osmo_sccp_addr *addr)
 
char * osmo_sccp_addr_to_str_c (void *ctx, const struct osmo_ss7_instance *ss7, const struct osmo_sccp_addr *addr)
 
int osmo_sccp_addr_to_id_buf (char *buf, size_t buf_len, const struct osmo_ss7_instance *ss7, const struct osmo_sccp_addr *addr)
 like osmo_sccp_addr_to_str_buf, but using only characters passing osmo_identifier_valid(). More...
 
char * osmo_sccp_addr_to_id_c (void *ctx, const struct osmo_ss7_instance *ss7, const struct osmo_sccp_addr *addr)
 
char * osmo_sccp_addr_name (const struct osmo_ss7_instance *ss7, const struct osmo_sccp_addr *addr)
 
int osmo_sccp_inst_addr_to_str_buf (char *buf, size_t buf_len, const struct osmo_sccp_instance *sccp, const struct osmo_sccp_addr *addr)
 
char * osmo_sccp_inst_addr_to_str_c (void *ctx, const struct osmo_sccp_instance *sccp, 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

◆ osmo_sccp_addr_dump()

◆ osmo_sccp_addr_name()

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

◆ osmo_sccp_addr_set_ssn()

void osmo_sccp_addr_set_ssn ( struct osmo_sccp_addr addr,
uint32_t  ssn 
)

◆ osmo_sccp_addr_to_id_buf()

int osmo_sccp_addr_to_id_buf ( char *  buf,
size_t  buf_len,
const struct osmo_ss7_instance ss7,
const struct osmo_sccp_addr addr 
)

like osmo_sccp_addr_to_str_buf, but using only characters passing osmo_identifier_valid().

Useful for FSM and CTRL IDs.

The advantage over using osmo_sccp_addr_to_str_buf() followed by osmo_identifier_sanitize_buf() is that here, the address elements are separated by ':', while osmo_identifier_sanitize_buf() would replace all characters with the same, e.g. '-'.

References sccp_addr_to_str_buf().

Referenced by osmo_sccp_addr_to_id_c().

◆ osmo_sccp_addr_to_id_c()

char* osmo_sccp_addr_to_id_c ( void *  ctx,
const struct osmo_ss7_instance ss7,
const struct osmo_sccp_addr addr 
)

◆ osmo_sccp_addr_to_str_buf()

int osmo_sccp_addr_to_str_buf ( char *  buf,
size_t  buf_len,
const struct osmo_ss7_instance ss7,
const struct osmo_sccp_addr addr 
)

◆ osmo_sccp_addr_to_str_c()

char* osmo_sccp_addr_to_str_c ( void *  ctx,
const struct osmo_ss7_instance ss7,
const struct osmo_sccp_addr addr 
)

◆ osmo_sccp_gt_dump()

◆ osmo_sccp_inst_addr_name()

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

◆ osmo_sccp_inst_addr_to_str_buf()

int osmo_sccp_inst_addr_to_str_buf ( char *  buf,
size_t  buf_len,
const struct osmo_sccp_instance sccp,
const struct osmo_sccp_addr addr 
)

◆ osmo_sccp_inst_addr_to_str_c()

char* osmo_sccp_inst_addr_to_str_c ( void *  ctx,
const struct osmo_sccp_instance sccp,
const struct osmo_sccp_addr addr 
)

◆ osmo_sccp_make_addr_pc_ssn()

◆ 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 
)

◆ 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 
)

◆ 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 
)

◆ osmo_sccp_tx_conn_resp_msg()

◆ osmo_sccp_tx_data()

◆ 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 
)

◆ osmo_sccp_tx_disconn_data()

◆ 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 
)

◆ 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 
)

◆ 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 
)

◆ sccp_addr_to_str_buf()

◆ scu_msgb_alloc()

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