libosmo-sigtran  1.9.0.4-dc82
Osmocom SIGTRAN library
osmo_ss7_xua_srv.c File Reference
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <inttypes.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <osmocom/sigtran/osmo_ss7.h>
#include <osmocom/sigtran/mtp_sap.h>
#include <osmocom/sigtran/protocol/mtp.h>
#include <osmocom/sigtran/protocol/sua.h>
#include <osmocom/sigtran/protocol/m3ua.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/select.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/socket.h>
#include <osmocom/core/sockaddr_str.h>
#include <osmocom/core/osmo_io.h>
#include <osmocom/netif/stream.h>
#include <osmocom/netif/ipa.h>
#include <osmocom/netif/sctp.h>
#include "sccp_internal.h"
#include "xua_internal.h"
#include "ss7_internal.h"
#include "xua_asp_fsm.h"
#include "xua_as_fsm.h"

Functions

static int xua_accept_cb (struct osmo_stream_srv_link *link, int fd)
 
struct osmo_xua_serverosmo_ss7_xua_server_create2 (struct osmo_ss7_instance *inst, int trans_proto, enum osmo_ss7_asp_protocol proto, uint16_t local_port, const char *local_host)
 create a new xUA server configured with given ip/port More...
 
struct osmo_xua_serverosmo_ss7_xua_server_create (struct osmo_ss7_instance *inst, enum osmo_ss7_asp_protocol proto, uint16_t local_port, const char *local_host)
 create a new xUA server configured with given ip/port More...
 
int osmo_ss7_xua_server_bind (struct osmo_xua_server *xs)
 Set the xUA server to bind/listen to the currently configured ip/port. More...
 
int osmo_ss7_xua_server_set_local_host (struct osmo_xua_server *xs, const char *local_host)
 
int osmo_ss7_xua_server_set_local_hosts (struct osmo_xua_server *xs, const char **local_hosts, size_t local_host_cnt)
 
int osmo_ss7_xua_server_add_local_host (struct osmo_xua_server *xs, const char *local_host)
 
int osmo_ss7_xua_server_del_local_host (struct osmo_xua_server *xs, const char *local_host)
 
bool ss7_xua_server_set_default_local_hosts (struct osmo_xua_server *oxs)
 
void osmo_ss7_xua_server_destroy (struct osmo_xua_server *xs)
 

Function Documentation

◆ osmo_ss7_xua_server_add_local_host()

int osmo_ss7_xua_server_add_local_host ( struct osmo_xua_server xs,
const char *  local_host 
)

◆ osmo_ss7_xua_server_bind()

int osmo_ss7_xua_server_bind ( struct osmo_xua_server xs)

Set the xUA server to bind/listen to the currently configured ip/port.

Parameters
[in]xsxUA server to operate
Returns
0 on success, negative value on error.

References osmo_xua_server::cfg, osmo_xua_server::local, osmo_ss7_asp_peer_snprintf(), osmo_ss7_asp_protocol_vals, osmo_xua_server::proto, osmo_xua_server::sctp_init, and osmo_xua_server::server.

Referenced by osmo_sccp_simple_server_on_ss7_id(), and osmo_ss7_vty_go_parent().

◆ osmo_ss7_xua_server_create()

struct osmo_xua_server* osmo_ss7_xua_server_create ( struct osmo_ss7_instance inst,
enum osmo_ss7_asp_protocol  proto,
uint16_t  local_port,
const char *  local_host 
)

create a new xUA server configured with given ip/port

Parameters
[in]ctxtalloc allocation context
[in]protoprotocol (xUA variant) to use
[in]local_portlocal SCTP port to bind/listen to
[in]local_hostlocal IP address to bind/listen to (optional)
Returns
callee-allocated osmo_xua_server in case of success

References osmo_ss7_xua_server_create2(), ss7_default_trans_proto_for_asp_proto(), and osmo_xua_server::trans_proto.

◆ osmo_ss7_xua_server_create2()

struct osmo_xua_server* osmo_ss7_xua_server_create2 ( struct osmo_ss7_instance inst,
int  trans_proto,
enum osmo_ss7_asp_protocol  proto,
uint16_t  local_port,
const char *  local_host 
)

create a new xUA server configured with given ip/port

Parameters
[in]instSS7 Instance on which we operate
[in]trans_prototransport protocol to use (one of IPPROTO_*)
[in]protoprotocol (xUA variant) to use
[in]local_portlocal SCTP port to bind/listen to
[in]local_hostlocal IP address to bind/listen to (optional)
Returns
callee-allocated osmo_xua_server in case of success

References osmo_xua_server::asp_list, osmo_xua_server::cfg, osmo_xua_server::inst, osmo_xua_server::list, osmo_xua_server::local, OSMO_SS7_ASP_PROT_SUA, osmo_ss7_asp_protocol_name(), osmo_ss7_asp_protocol_vals, osmo_ss7_ensure_sccp(), osmo_ss7_xua_server_set_local_host(), osmo_ss7_asp_peer::port, osmo_xua_server::proto, osmo_xua_server::server, ss7_asp_protocol_check_trans_proto(), ss7_initialized, osmo_xua_server::trans_proto, xua_accept_cb(), and osmo_ss7_instance::xua_servers.

Referenced by DEFUN_ATTR(), osmo_sccp_simple_server_on_ss7_id(), and osmo_ss7_xua_server_create().

◆ osmo_ss7_xua_server_del_local_host()

int osmo_ss7_xua_server_del_local_host ( struct osmo_xua_server xs,
const char *  local_host 
)

◆ osmo_ss7_xua_server_destroy()

◆ osmo_ss7_xua_server_set_local_host()

int osmo_ss7_xua_server_set_local_host ( struct osmo_xua_server xs,
const char *  local_host 
)

◆ osmo_ss7_xua_server_set_local_hosts()

int osmo_ss7_xua_server_set_local_hosts ( struct osmo_xua_server xs,
const char **  local_hosts,
size_t  local_host_cnt 
)

◆ ss7_xua_server_set_default_local_hosts()

◆ xua_accept_cb()