libosmo-sigtran 2.1.0.148-c8e68
Osmocom SIGTRAN library
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
sccp_user.c File Reference
#include <stdbool.h>
#include <string.h>
#include <limits.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/logging.h>
#include <osmocom/sigtran/osmo_ss7.h>
#include <osmocom/sigtran/sccp_sap.h>
#include <osmocom/sigtran/mtp_sap.h>
#include <osmocom/sigtran/protocol/mtp.h>
#include <osmocom/sigtran/sccp_helpers.h>
#include <osmocom/sccp/sccp_types.h>
#include "sccp_connection.h"
#include "sccp_instance.h"
#include "sccp_internal.h"
#include "sccp_user.h"
#include "xua_internal.h"
#include "ss7_as.h"
#include "ss7_asp.h"
#include "ss7_route.h"
#include "ss7_route_table.h"
#include "ss7_internal.h"
#include "ss7_xua_srv.h"

Functions

struct osmo_sccp_usersccp_user_alloc (struct osmo_sccp_instance *inst, const char *name, osmo_prim_cb prim_cb, uint16_t ssn, uint32_t pc)
 
static void sccp_user_flush_connections (struct osmo_sccp_user *scu)
 
void sccp_user_free (struct osmo_sccp_user *scu)
 
void osmo_sccp_user_unbind (struct osmo_sccp_user *scu)
 Unbind a given SCCP user. More...
 
void osmo_sccp_user_set_priv (struct osmo_sccp_user *scu, void *priv)
 
void * osmo_sccp_user_get_priv (struct osmo_sccp_user *scu)
 
int sccp_user_prim_up (struct osmo_sccp_user *scu, struct osmo_scu_prim *prim)
 Send a SCCP User SAP Primitive up to the User. More...
 
const char * osmo_sccp_user_name (struct osmo_sccp_user *scu)
 Compose a human readable string to describe the SCCP user's connection. More...
 
struct osmo_sccp_instanceosmo_sccp_get_sccp (const struct osmo_sccp_user *scu)
 get the SCCP instance that is related to the given sccp user More...
 

Function Documentation

◆ osmo_sccp_get_sccp()

struct osmo_sccp_instance * osmo_sccp_get_sccp ( const struct osmo_sccp_user scu)

get the SCCP instance that is related to the given sccp user

Parameters
[in]scuSCCP user
Returns
SCCP instance; NULL if scu was NULL

References osmo_sccp_user::inst, and NULL.

◆ osmo_sccp_user_get_priv()

void * osmo_sccp_user_get_priv ( struct osmo_sccp_user scu)

References osmo_sccp_user::priv.

◆ osmo_sccp_user_name()

const char * osmo_sccp_user_name ( struct osmo_sccp_user scu)

Compose a human readable string to describe the SCCP user's connection.

The output follows ['<scu.name>':]<local-sccp-addr>, e.g. "'OsmoHNBW':RI=SSN_PC,PC=0.23.5,SSN=RANAP", or just "RI=SSN_PC,PC=0.23.5,SSN=RANAP" if no scu->name is set. This calls osmo_sccp_addr_name(), which returns a static buffer; hence calling this function and osmo_sccp_addr_name() in the same printf statement is likely to conflict.

References osmo_sccp_user::inst, osmo_sccp_user::name, osmo_sccp_addr_name(), osmo_sccp_make_addr_pc_ssn(), osmo_sccp_user::pc, osmo_sccp_instance::ss7, and osmo_sccp_user::ssn.

◆ osmo_sccp_user_set_priv()

void osmo_sccp_user_set_priv ( struct osmo_sccp_user scu,
void *  priv 
)

References osmo_sccp_user::priv.

◆ osmo_sccp_user_unbind()

void osmo_sccp_user_unbind ( struct osmo_sccp_user scu)

Unbind a given SCCP user.

Parameters
[in]scuSCCP User which is to be un-bound. Will be destroyed at the time this function returns.

References LOGPSCU, and sccp_user_free().

Referenced by osmo_sccp_instance_destroy().

◆ sccp_user_alloc()

struct osmo_sccp_user * sccp_user_alloc ( struct osmo_sccp_instance inst,
const char *  name,
osmo_prim_cb  prim_cb,
uint16_t  ssn,
uint32_t  pc 
)

◆ sccp_user_flush_connections()

static void sccp_user_flush_connections ( struct osmo_sccp_user scu)
static

◆ sccp_user_free()

void sccp_user_free ( struct osmo_sccp_user scu)

◆ sccp_user_prim_up()

int sccp_user_prim_up ( struct osmo_sccp_user scu,
struct osmo_scu_prim prim 
)

Send a SCCP User SAP Primitive up to the User.

Parameters
[in]scuSCCP User to whom to send the primitive
[in]primPrimitive to send to the user
Returns
return value of the SCCP User's prim_cb() function

Ownership of prim->oph->msg is passed to the user of the registered callback

References LOGPSCU, osmo_scu_prim::oph, osmo_scu_prim_name(), and osmo_sccp_user::prim_cb.

Referenced by sccp_conn_scu_gen_encode_and_send(), sccp_lbcs_local_bcast_pcstate(), sccp_lbcs_local_bcast_state(), sclc_rx_cldr(), and sclc_rx_cldt().