libosmo-sigtran: src/ss7_xua_srv.c File Reference

libosmo-sigtran 2.2.1.99-1c6a Osmocom SIGTRAN library

Functions
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_asp.h"`
`#include "ss7_internal.h"`
`#include "xua_asp_fsm.h"`
`#include "xua_as_fsm.h"`
`#include "xua_lm_sap.h"`
`#include "ss7_xua_srv.h"`

## Functions
static int | xua_accept_cb (struct osmo_stream_srv_link *link, int fd)
struct osmo_xua_server * | 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_server * | 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...
static int | ss7_xua_srv_apply_sctp_init_pars (struct osmo_xua_server *xs)
int | ss7_xua_server_bind (struct osmo_xua_server *xs)
| Set the xUA server to bind/listen to the currently configured ip/port. More...
int | ss7_xua_server_set_local_host (struct osmo_xua_server *xs, const char *local_host)
int | ss7_xua_server_set_local_hosts (struct osmo_xua_server *xs, const char **local_hosts, size_t local_host_cnt)
int | ss7_xua_server_add_local_host (struct osmo_xua_server *xs, const char *local_host)
int | 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 | ss7_xua_server_destroy (struct osmo_xua_server *xs)
struct osmo_xua_server * | ss7_xua_server_find2 (struct osmo_ss7_instance *inst, int trans_proto, enum osmo_ss7_asp_protocol proto, uint16_t local_port)
| find an xUA server with the given parameters More...
struct osmo_xua_server * | ss7_xua_server_find (struct osmo_ss7_instance *inst, enum osmo_ss7_asp_protocol proto, uint16_t local_port)
| find an xUA server with the given parameters More...

## Function Documentation

## ◆ ss7_xua_server_add_local_host()

int ss7_xua_server_add_local_host | ( | struct osmo_xua_server * | xs,
|  | const char * | local_host
| ) |  |

References osmo_xua_server::cfg, osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, osmo_xua_server::local, osmo_xua_server::server, and ss7_asp_peer_add_host().

Referenced by DEFUN_ATTR().

## ◆ ss7_xua_server_bind()

int ss7_xua_server_bind | ( | struct osmo_xua_server * | xs | ) |

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

Parameters

  [in] | xs | xUA server to operate

Returns
  0 on success, negative value on error.

References osmo_xua_server::cfg, osmo_xua_server::local, osmo_ss7_asp_protocol_vals, osmo_xua_server::proto, osmo_xua_server::server, ss7_asp_peer_snprintf(), ss7_xua_srv_apply_sctp_init_pars(), and osmo_xua_server::trans_proto.

Referenced by osmo_sccp_simple_server_on_ss7_id(), and ss7_vty_node_oxs_go_parent().

## ◆ ss7_xua_server_create()

struct osmo_xua_server * 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] | ctx | talloc allocation context
  [in] | proto | protocol (xUA variant) to use
  [in] | local_port | local SCTP port to bind/listen to
  [in] | local_host | local IP address to bind/listen to (optional)

Returns
  callee-allocated osmo_xua_server in case of success

References osmo_xua_server::inst, osmo_xua_server::proto, ss7_default_trans_proto_for_asp_proto(), ss7_xua_server_create2(), and osmo_xua_server::trans_proto.

## ◆ ss7_xua_server_create2()

struct osmo_xua_server * 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] | inst | SS7 Instance on which we operate
  [in] | trans_proto | transport protocol to use (one of IPPROTO_*)
  [in] | proto | protocol (xUA variant) to use
  [in] | local_port | local SCTP port to bind/listen to
  [in] | local_host | local 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, NULL, OSMO_SS7_ASP_PROT_SUA, osmo_ss7_asp_protocol_name(), osmo_ss7_asp_protocol_vals, osmo_ss7_ensure_sccp(), osmo_ss7_asp_peer::port, osmo_xua_server::proto, osmo_xua_server::server, ss7_asp_protocol_check_trans_proto(), ss7_initialized, ss7_xua_server_set_local_host(), 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 ss7_xua_server_create().

## ◆ ss7_xua_server_del_local_host()

int ss7_xua_server_del_local_host | ( | struct osmo_xua_server * | xs,
|  | const char * | local_host
| ) |  |

References osmo_xua_server::cfg, osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, osmo_xua_server::local, osmo_xua_server::server, and ss7_asp_peer_del_host().

Referenced by DEFUN_ATTR().

## ◆ ss7_xua_server_destroy()

void ss7_xua_server_destroy | ( | struct osmo_xua_server * | xs | ) |

References osmo_xua_server::asp_list, osmo_xua_server::list, NULL, osmo_xua_server::server, osmo_ss7_asp::siblings, and ss7_asp_disconnect_stream().

Referenced by DEFUN_ATTR(), and osmo_sccp_simple_server_on_ss7_id().

## ◆ ss7_xua_server_find()

struct osmo_xua_server * ss7_xua_server_find | ( | struct osmo_ss7_instance * | inst,
|  | enum osmo_ss7_asp_protocol | proto,
|  | uint16_t | local_port
| ) |  |

find an xUA server with the given parameters

Parameters

  [in] | inst | SS7 Instance on which we operate
  [in] | proto | protocol (xUA variant) in use
  [in] | local_port | local port of the server

Returns
  osmo_xua_server or NULL (not found)

References osmo_xua_server::inst, osmo_xua_server::proto, ss7_default_trans_proto_for_asp_proto(), ss7_xua_server_find2(), and osmo_xua_server::trans_proto.

## ◆ ss7_xua_server_find2()

struct osmo_xua_server * ss7_xua_server_find2 | ( | struct osmo_ss7_instance * | inst,
|  | int | trans_proto,
|  | enum osmo_ss7_asp_protocol | proto,
|  | uint16_t | local_port
| ) |  |

find an xUA server with the given parameters

Parameters

  [in] | inst | SS7 Instance on which we operate
  [in] | trans_proto | transport protocol in use (one of IPPROTO_*)
  [in] | proto | protocol (xUA variant) in use
  [in] | local_port | local port of the server

Returns
  osmo_xua_server or NULL (not found)

References osmo_xua_server::cfg, osmo_xua_server::inst, osmo_xua_server::list, osmo_xua_server::local, NULL, osmo_ss7_asp_peer::port, osmo_xua_server::proto, ss7_initialized, osmo_xua_server::trans_proto, and osmo_ss7_instance::xua_servers.

Referenced by DEFUN_ATTR(), osmo_sccp_simple_client_on_ss7_id(), osmo_sccp_simple_server_add_clnt(), and ss7_xua_server_find().

## ◆ ss7_xua_server_set_default_local_hosts()

bool ss7_xua_server_set_default_local_hosts | ( | struct osmo_xua_server * | oxs | ) |

References osmo_xua_server::cfg, osmo_ss7_asp_peer::host_cnt, osmo_xua_server::local, ss7_ipv6_sctp_supported(), and ss7_xua_server_set_local_host().

Referenced by ss7_vty_node_oxs_go_parent().

## ◆ ss7_xua_server_set_local_host()

int ss7_xua_server_set_local_host | ( | struct osmo_xua_server * | xs,
|  | const char * | local_host
| ) |  |

References ss7_xua_server_set_local_hosts().

Referenced by ss7_xua_server_create2(), and ss7_xua_server_set_default_local_hosts().

## ◆ ss7_xua_server_set_local_hosts()

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

References osmo_xua_server::cfg, osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, osmo_xua_server::local, osmo_xua_server::server, ss7_asp_peer_set_hosts(), and ss7_initialized.

Referenced by DEFUN_ATTR(), and ss7_xua_server_set_local_host().

## ◆ ss7_xua_srv_apply_sctp_init_pars()

static int ss7_xua_srv_apply_sctp_init_pars | ( | struct osmo_xua_server * | xs | ) |
| static

References osmo_xua_server::cfg, osmo_xua_server::max_instreams_present, osmo_xua_server::max_instreams_value, osmo_xua_server::num_ostreams_present, osmo_xua_server::num_ostreams_value, osmo_xua_server::sctp_init, and osmo_xua_server::server.

Referenced by ss7_xua_server_bind().

## ◆ xua_accept_cb()

static int xua_accept_cb | ( | struct osmo_stream_srv_link * | link,
|  | int | fd
| ) |  |
| static

References osmo_xua_server::accept_dyn_reg, osmo_ss7_asp::adm_state, osmo_xua_server::asp_list, osmo_ss7_asp::cfg, osmo_xua_server::cfg, osmo_ss7_asp::dyn_allocated, osmo_ss7_asp::fi, osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, osmo_xua_server::inst, osmo_ss7_asp::is_server, osmo_ss7_asp::local, osmo_xua_server::local, LOGPASP, M3UA_MSG_HEADROOM, M3UA_MSG_SIZE, osmo_ss7_asp::name, NULL, osmo_ss7_asp_destroy(), osmo_ss7_asp_find_or_create2(), OSMO_SS7_ASP_PROT_IPA, OSMO_SS7_ASP_PROT_M3UA, osmo_ss7_asp_protocol_vals, OSMO_SS7_ASP_ROLE_SG, OSMO_XLM_PRIM_M_SCTP_ESTABLISH, osmo_ss7_asp_peer::port, osmo_xua_server::proto, osmo_ss7_asp::remote, osmo_ss7_asp::role, osmo_ss7_asp::server, osmo_ss7_asp::shutdown, osmo_ss7_asp::siblings, osmo_ss7_asp::sock_name, ss7_asp_apply_peer_primary_address(), ss7_asp_apply_primary_address(), ss7_asp_apply_tcp_pars(), ss7_asp_disconnect_stream(), ss7_asp_find_by_socket_addr(), ss7_asp_ipa_srv_conn_rx_cb(), ss7_asp_m3ua_tcp_srv_conn_rx_cb(), ss7_asp_peer_set_hosts(), ss7_asp_xua_layer_manager_start(), ss7_asp_xua_srv_conn_closed_cb(), ss7_asp_xua_srv_conn_rx_cb(), osmo_ss7_asp::trans_proto, osmo_xua_server::trans_proto, XUA_ASP_E_SCTP_EST_IND, xua_asp_fsm_start(), xua_asp_send_xlm_prim_simple(), osmo_ss7_asp::xua_server, and xua_tcp_segmentation_cb().

Referenced by ss7_xua_server_create2().