libosmo-sigtran
1.9.0.1-797d
Osmocom SIGTRAN library
|
#include <errno.h>
#include <string.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/endian.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/sccp/sccp_types.h>
#include <osmocom/sccp/sccp.h>
Data Structures | |
struct | sccp_system |
struct | sccp_data_callback |
struct | udt_offsets |
Macros | |
#define | SCCP_MSG_SIZE 4096 |
#define | SCCP_MSG_HEADROOM 128 |
Functions | |
static | LLIST_HEAD (sccp_connections) |
static | LLIST_HEAD (sccp_callbacks) |
static struct sccp_data_callback * | _find_ssn (uint8_t ssn) |
static void | _send_msg (struct sccp_connection *conn, struct msgb *msg, void *ctx) |
static int | copy_address (struct sccp_address *addr, uint8_t offset, struct msgb *msgb) |
static int | _sccp_parse_optional_data (const int offset, struct msgb *msgb, struct sccp_optional_data *data) |
int | _sccp_parse_connection_request (struct msgb *msgb, struct sccp_parse_result *result) |
int | _sccp_parse_connection_released (struct msgb *msgb, struct sccp_parse_result *result) |
int | _sccp_parse_connection_refused (struct msgb *msgb, struct sccp_parse_result *result) |
int | _sccp_parse_connection_confirm (struct msgb *msgb, struct sccp_parse_result *result) |
int | _sccp_parse_connection_release_complete (struct msgb *msgb, struct sccp_parse_result *result) |
int | _sccp_parse_connection_dt1 (struct msgb *msgb, struct sccp_parse_result *result) |
static int | _sccp_parse_unitdata (struct msgb *msgb, struct sccp_parse_result *result, const struct udt_offsets *offs) |
int | _sccp_parse_udt (struct msgb *msgb, struct sccp_parse_result *result) |
int | _sccp_parse_udts (struct msgb *msgb, struct sccp_parse_result *result) |
static int | _sccp_parse_xudt (struct msgb *msgb, struct sccp_parse_result *result) |
static int | _sccp_parse_xudts (struct msgb *msgb, struct sccp_parse_result *result) |
static int | _sccp_parse_it (struct msgb *msgb, struct sccp_parse_result *result) |
static int | _sccp_parse_err (struct msgb *msgb, struct sccp_parse_result *result) |
int | sccp_create_sccp_addr (struct msgb *msg, const struct sockaddr_sccp *sock) |
struct msgb * | sccp_create_udt (int class, const struct sockaddr_sccp *in, const struct sockaddr_sccp *out, uint8_t *in_data, int len) |
static int | _sccp_send_data (int class, const struct sockaddr_sccp *in, const struct sockaddr_sccp *out, struct msgb *payload, void *ctx) |
static int | _sccp_handle_read (struct msgb *msgb) |
static int | source_local_reference_is_free (struct sccp_source_reference *reference) |
static int | destination_local_reference_is_free (struct sccp_source_reference *reference) |
static int | assign_source_local_reference (struct sccp_connection *connection) |
static void | _sccp_set_connection_state (struct sccp_connection *connection, int new_state) |
struct msgb * | sccp_create_refuse (struct sccp_source_reference *src_ref, int cause, uint8_t *inp, int length) |
static int | _sccp_send_refuse (struct sccp_source_reference *src_ref, int cause, void *ctx) |
struct msgb * | sccp_create_cc (struct sccp_source_reference *src_ref, struct sccp_source_reference *dst_ref) |
static int | _sccp_send_connection_confirm (struct sccp_connection *connection) |
struct msgb * | sccp_create_cr (const struct sccp_source_reference *src_ref, const struct sockaddr_sccp *called, const uint8_t *l3_data, size_t l3_length) |
static int | _sccp_send_connection_request (struct sccp_connection *connection, const struct sockaddr_sccp *called, struct msgb *msg) |
struct msgb * | sccp_create_dt1 (struct sccp_source_reference *dst_ref, uint8_t *inp_data, uint8_t len) |
static int | _sccp_send_connection_data (struct sccp_connection *conn, struct msgb *_data) |
static int | _sccp_send_connection_it (struct sccp_connection *conn) |
struct msgb * | sccp_create_rlsd (struct sccp_source_reference *src_ref, struct sccp_source_reference *dst_ref, int cause) |
static int | _sccp_send_connection_released (struct sccp_connection *conn, int cause) |
static int | _sccp_handle_connection_request (struct msgb *msgb, void *ctx) |
static int | _sccp_handle_connection_release_complete (struct msgb *msgb) |
static int | _sccp_handle_connection_dt1 (struct msgb *msgb) |
static int | _sccp_send_connection_release_complete (struct sccp_connection *connection) |
static int | _sccp_handle_connection_released (struct msgb *msgb) |
static int | _sccp_handle_connection_refused (struct msgb *msgb) |
static int | _sccp_handle_connection_confirm (struct msgb *msgb) |
int | sccp_system_init (void(*outgoing)(struct sccp_connection *conn, struct msgb *data, void *, void *), void *ctx) |
int | sccp_system_incoming (struct msgb *msgb) |
int | sccp_system_incoming_ctx (struct msgb *msgb, void *ctx) |
int | sccp_connection_write (struct sccp_connection *connection, struct msgb *data) |
int | sccp_connection_send_it (struct sccp_connection *connection) |
int | sccp_connection_close (struct sccp_connection *connection, int cause) |
int | sccp_connection_free (struct sccp_connection *connection) |
int | sccp_connection_force_free (struct sccp_connection *con) |
struct sccp_connection * | sccp_connection_socket (void) |
int | sccp_connection_connect (struct sccp_connection *conn, const struct sockaddr_sccp *local, struct msgb *data) |
int | sccp_connection_set_incoming (const struct sockaddr_sccp *sock, int(*accept_cb)(struct sccp_connection *, void *), void *context) |
int | sccp_write (struct msgb *data, const struct sockaddr_sccp *in, const struct sockaddr_sccp *out, int class, void *ctx) |
int | sccp_set_read (const struct sockaddr_sccp *sock, int(*read_cb)(struct msgb *, unsigned int, void *), void *context) |
osmo_static_assert (sizeof(struct sccp_source_reference)<=sizeof(uint32_t), enough_space) | |
uint32_t | sccp_src_ref_to_int (struct sccp_source_reference *ref) |
struct sccp_source_reference | sccp_src_ref_from_int (uint32_t int_ref) |
int | sccp_determine_msg_type (struct msgb *msg) |
int | sccp_parse_header (struct msgb *msg, struct sccp_parse_result *result) |
static | __attribute__ ((constructor)) |
static | __attribute__ ((destructor)) |
void | sccp_set_log_area (int log_area) |
Variables | |
static int | DSCCP = 0 |
static void * | tall_sccp_ctx |
const struct sockaddr_sccp | sccp_ssn_bssap |
static struct sccp_system | sccp_system |
#define SCCP_MSG_HEADROOM 128 |
#define SCCP_MSG_SIZE 4096 |
|
static |
References tall_sccp_ctx.
|
static |
References tall_sccp_ctx.
|
static |
References sccp_data_callback::callback, DSCCP, sccp_data_callback::ssn, and tall_sccp_ctx.
Referenced by _sccp_handle_connection_request(), _sccp_handle_read(), sccp_connection_set_incoming(), and sccp_set_read().
|
static |
References _sccp_parse_connection_confirm(), _sccp_set_connection_state(), DSCCP, and sccp_connection::incoming.
Referenced by sccp_system_incoming_ctx().
|
static |
References _sccp_parse_connection_dt1(), and DSCCP.
Referenced by sccp_system_incoming_ctx().
|
static |
References _sccp_parse_connection_refused(), _sccp_set_connection_state(), DSCCP, and sccp_connection::incoming.
Referenced by sccp_system_incoming_ctx().
|
static |
References _sccp_parse_connection_release_complete(), _sccp_set_connection_state(), and DSCCP.
Referenced by sccp_system_incoming_ctx().
|
static |
References _sccp_parse_connection_released(), _sccp_send_connection_release_complete(), and DSCCP.
Referenced by sccp_system_incoming_ctx().
|
static |
References _find_ssn(), _sccp_parse_connection_request(), _sccp_send_connection_confirm(), _sccp_send_refuse(), _sccp_set_connection_state(), sccp_data_callback::accept_cb, sccp_data_callback::accept_context, destination_local_reference_is_free(), DSCCP, sccp_connection::incoming, and tall_sccp_ctx.
Referenced by sccp_system_incoming_ctx().
|
static |
References _find_ssn(), _sccp_parse_udt(), DSCCP, sccp_data_callback::read_cb, and sccp_data_callback::read_context.
Referenced by sccp_system_incoming_ctx().
int _sccp_parse_connection_confirm | ( | struct msgb * | msgb, |
struct sccp_parse_result * | result | ||
) |
References _sccp_parse_optional_data(), and DSCCP.
Referenced by _sccp_handle_connection_confirm(), and sccp_parse_header().
int _sccp_parse_connection_dt1 | ( | struct msgb * | msgb, |
struct sccp_parse_result * | result | ||
) |
References DSCCP.
Referenced by _sccp_handle_connection_dt1(), and sccp_parse_header().
int _sccp_parse_connection_refused | ( | struct msgb * | msgb, |
struct sccp_parse_result * | result | ||
) |
References _sccp_parse_optional_data(), and DSCCP.
Referenced by _sccp_handle_connection_refused(), and sccp_parse_header().
int _sccp_parse_connection_release_complete | ( | struct msgb * | msgb, |
struct sccp_parse_result * | result | ||
) |
References DSCCP.
Referenced by _sccp_handle_connection_release_complete(), and sccp_parse_header().
int _sccp_parse_connection_released | ( | struct msgb * | msgb, |
struct sccp_parse_result * | result | ||
) |
References _sccp_parse_optional_data(), and DSCCP.
Referenced by _sccp_handle_connection_released(), and sccp_parse_header().
int _sccp_parse_connection_request | ( | struct msgb * | msgb, |
struct sccp_parse_result * | result | ||
) |
References _sccp_parse_optional_data(), copy_address(), and DSCCP.
Referenced by _sccp_handle_connection_request(), and sccp_parse_header().
|
static |
References DSCCP.
Referenced by sccp_parse_header().
|
static |
References DSCCP.
Referenced by sccp_parse_header().
|
static |
References DSCCP.
Referenced by _sccp_parse_connection_confirm(), _sccp_parse_connection_refused(), _sccp_parse_connection_released(), and _sccp_parse_connection_request().
int _sccp_parse_udt | ( | struct msgb * | msgb, |
struct sccp_parse_result * | result | ||
) |
References _sccp_parse_unitdata(), and udt_offsets::header_size.
Referenced by _sccp_handle_read(), and sccp_parse_header().
int _sccp_parse_udts | ( | struct msgb * | msgb, |
struct sccp_parse_result * | result | ||
) |
References _sccp_parse_unitdata(), and udt_offsets::header_size.
Referenced by sccp_parse_header().
|
static |
References udt_offsets::called_offset, udt_offsets::calling_offset, copy_address(), udt_offsets::data_offset, DSCCP, and udt_offsets::header_size.
Referenced by _sccp_parse_udt(), _sccp_parse_udts(), _sccp_parse_xudt(), and _sccp_parse_xudts().
|
static |
References _sccp_parse_unitdata(), and udt_offsets::header_size.
Referenced by sccp_parse_header().
|
static |
References _sccp_parse_unitdata(), and udt_offsets::header_size.
Referenced by sccp_parse_header().
|
static |
References _sccp_set_connection_state(), _send_msg(), assign_source_local_reference(), and sccp_create_cc().
Referenced by _sccp_handle_connection_request().
|
static |
References _send_msg(), DSCCP, and sccp_create_dt1().
Referenced by sccp_connection_write().
|
static |
References _send_msg(), SCCP_MSG_HEADROOM, and SCCP_MSG_SIZE.
Referenced by sccp_connection_send_it().
|
static |
References _sccp_set_connection_state(), _send_msg(), SCCP_MSG_HEADROOM, and SCCP_MSG_SIZE.
Referenced by _sccp_handle_connection_released().
|
static |
References _sccp_set_connection_state(), _send_msg(), and sccp_create_rlsd().
Referenced by sccp_connection_close().
|
static |
References _sccp_set_connection_state(), _send_msg(), assign_source_local_reference(), DSCCP, and sccp_create_cr().
Referenced by sccp_connection_connect().
|
static |
References _send_msg(), and sccp_create_udt().
Referenced by sccp_write().
|
static |
References _send_msg(), and sccp_create_refuse().
Referenced by _sccp_handle_connection_request().
|
static |
Referenced by _sccp_handle_connection_confirm(), _sccp_handle_connection_refused(), _sccp_handle_connection_release_complete(), _sccp_handle_connection_request(), _sccp_send_connection_confirm(), _sccp_send_connection_release_complete(), _sccp_send_connection_released(), and _sccp_send_connection_request().
|
static |
References sccp_system::write_context, and sccp_system::write_data.
Referenced by _sccp_send_connection_confirm(), _sccp_send_connection_data(), _sccp_send_connection_it(), _sccp_send_connection_release_complete(), _sccp_send_connection_released(), _sccp_send_connection_request(), _sccp_send_data(), and _sccp_send_refuse().
|
static |
References DSCCP, and source_local_reference_is_free().
Referenced by _sccp_send_connection_confirm(), and _sccp_send_connection_request().
|
static |
References DSCCP.
Referenced by _sccp_parse_connection_request(), and _sccp_parse_unitdata().
|
static |
Referenced by _sccp_handle_connection_request().
|
static |
|
static |
osmo_static_assert | ( | sizeof(struct sccp_source_reference)<=sizeof(uint32_t) | , |
enough_space | |||
) |
Referenced by sccp_set_read().
int sccp_connection_close | ( | struct sccp_connection * | connection, |
int | cause | ||
) |
References _sccp_send_connection_released(), and DSCCP.
int sccp_connection_connect | ( | struct sccp_connection * | conn, |
const struct sockaddr_sccp * | local, | ||
struct msgb * | data | ||
) |
References _sccp_send_connection_request().
int sccp_connection_force_free | ( | struct sccp_connection * | con | ) |
References sccp_connection_free().
int sccp_connection_free | ( | struct sccp_connection * | connection | ) |
References DSCCP.
Referenced by sccp_connection_force_free().
int sccp_connection_send_it | ( | struct sccp_connection * | connection | ) |
References _sccp_send_connection_it(), and DSCCP.
int sccp_connection_set_incoming | ( | const struct sockaddr_sccp * | sock, |
int(*)(struct sccp_connection *, void *) | accept_cb, | ||
void * | context | ||
) |
References _find_ssn(), sccp_data_callback::accept_cb, and sccp_data_callback::accept_context.
struct sccp_connection* sccp_connection_socket | ( | void | ) |
References tall_sccp_ctx.
int sccp_connection_write | ( | struct sccp_connection * | connection, |
struct msgb * | data | ||
) |
References _sccp_send_connection_data(), and DSCCP.
struct msgb* sccp_create_cc | ( | struct sccp_source_reference * | src_ref, |
struct sccp_source_reference * | dst_ref | ||
) |
References DSCCP, SCCP_MSG_HEADROOM, and SCCP_MSG_SIZE.
Referenced by _sccp_send_connection_confirm().
struct msgb* sccp_create_cr | ( | const struct sccp_source_reference * | src_ref, |
const struct sockaddr_sccp * | called, | ||
const uint8_t * | l3_data, | ||
size_t | l3_length | ||
) |
References data, DSCCP, sccp_create_sccp_addr(), SCCP_MSG_HEADROOM, and SCCP_MSG_SIZE.
Referenced by _sccp_send_connection_request().
struct msgb* sccp_create_dt1 | ( | struct sccp_source_reference * | dst_ref, |
uint8_t * | inp_data, | ||
uint8_t | len | ||
) |
References data, DSCCP, len, SCCP_MSG_HEADROOM, and SCCP_MSG_SIZE.
Referenced by _sccp_send_connection_data().
struct msgb* sccp_create_refuse | ( | struct sccp_source_reference * | src_ref, |
int | cause, | ||
uint8_t * | inp, | ||
int | length | ||
) |
References data, DSCCP, SCCP_MSG_HEADROOM, and SCCP_MSG_SIZE.
Referenced by _sccp_send_refuse().
struct msgb* sccp_create_rlsd | ( | struct sccp_source_reference * | src_ref, |
struct sccp_source_reference * | dst_ref, | ||
int | cause | ||
) |
References data, DSCCP, SCCP_MSG_HEADROOM, and SCCP_MSG_SIZE.
Referenced by _sccp_send_connection_released().
int sccp_create_sccp_addr | ( | struct msgb * | msg, |
const struct sockaddr_sccp * | sock | ||
) |
References len.
Referenced by sccp_create_cr(), and sccp_create_udt().
struct msgb* sccp_create_udt | ( | int | class, |
const struct sockaddr_sccp * | in, | ||
const struct sockaddr_sccp * | out, | ||
uint8_t * | in_data, | ||
int | len | ||
) |
References data, DSCCP, len, sccp_create_sccp_addr(), SCCP_MSG_HEADROOM, and SCCP_MSG_SIZE.
Referenced by _sccp_send_data().
int sccp_determine_msg_type | ( | struct msgb * | msg | ) |
int sccp_parse_header | ( | struct msgb * | msg, |
struct sccp_parse_result * | result | ||
) |
References _sccp_parse_connection_confirm(), _sccp_parse_connection_dt1(), _sccp_parse_connection_refused(), _sccp_parse_connection_release_complete(), _sccp_parse_connection_released(), _sccp_parse_connection_request(), _sccp_parse_err(), _sccp_parse_it(), _sccp_parse_udt(), _sccp_parse_udts(), _sccp_parse_xudt(), _sccp_parse_xudts(), and DSCCP.
void sccp_set_log_area | ( | int | log_area | ) |
References DSCCP.
int sccp_set_read | ( | const struct sockaddr_sccp * | sock, |
int(*)(struct msgb *, unsigned int, void *) | read_cb, | ||
void * | context | ||
) |
struct sccp_source_reference sccp_src_ref_from_int | ( | uint32_t | int_ref | ) |
uint32_t sccp_src_ref_to_int | ( | struct sccp_source_reference * | ref | ) |
int sccp_system_incoming | ( | struct msgb * | msgb | ) |
References sccp_system_incoming_ctx().
int sccp_system_incoming_ctx | ( | struct msgb * | msgb, |
void * | ctx | ||
) |
int sccp_system_init | ( | void(*)(struct sccp_connection *conn, struct msgb *data, void *, void *) | outgoing, |
void * | ctx | ||
) |
References sccp_system::write_context, and sccp_system::write_data.
int sccp_write | ( | struct msgb * | data, |
const struct sockaddr_sccp * | in, | ||
const struct sockaddr_sccp * | out, | ||
int | class, | ||
void * | ctx | ||
) |
References _sccp_send_data().
|
static |
Referenced by assign_source_local_reference().
|
static |
Referenced by _find_ssn(), _sccp_handle_connection_confirm(), _sccp_handle_connection_dt1(), _sccp_handle_connection_refused(), _sccp_handle_connection_release_complete(), _sccp_handle_connection_released(), _sccp_handle_connection_request(), _sccp_handle_read(), _sccp_parse_connection_confirm(), _sccp_parse_connection_dt1(), _sccp_parse_connection_refused(), _sccp_parse_connection_release_complete(), _sccp_parse_connection_released(), _sccp_parse_connection_request(), _sccp_parse_err(), _sccp_parse_it(), _sccp_parse_optional_data(), _sccp_parse_unitdata(), _sccp_send_connection_data(), _sccp_send_connection_request(), assign_source_local_reference(), copy_address(), sccp_connection_close(), sccp_connection_free(), sccp_connection_send_it(), sccp_connection_write(), sccp_create_cc(), sccp_create_cr(), sccp_create_dt1(), sccp_create_refuse(), sccp_create_rlsd(), sccp_create_udt(), sccp_parse_header(), sccp_set_log_area(), and sccp_system_incoming_ctx().
const struct sockaddr_sccp sccp_ssn_bssap |
|
static |
|
static |
Referenced by __attribute__(), _find_ssn(), _sccp_handle_connection_request(), and sccp_connection_socket().