libosmogb
1.4.1
Osmocom Gb library
|
GPRS Networks Service (NS) messages on the Gb interface 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05) More...
Files | |
file | gprs_ns.h |
file | gprs_ns.c |
GPRS Networks Service (NS) messages on the Gb interface. | |
Data Structures | |
struct | gprs_ns_hdr |
Common header of GPRS NS. More... | |
struct | gprs_ns_ie_ip4_elem |
Section 10.3.2c List of IP4 Elements. More... | |
Macros | |
#define | ns_set_state(ns_, st_) ns_set_state_with_log(ns_, st_, false, __FILE__, __LINE__) |
#define | ns_set_remote_state(ns_, st_) ns_set_state_with_log(ns_, st_, true, __FILE__, __LINE__) |
#define | ns_mark_blocked(ns_) ns_set_state(ns_, (ns_)->state | NSE_S_BLOCKED) |
#define | ns_mark_unblocked(ns_) ns_set_state(ns_, (ns_)->state & (~NSE_S_BLOCKED)); |
#define | ns_mark_alive(ns_) ns_set_state(ns_, (ns_)->state | NSE_S_ALIVE) |
#define | ns_mark_dead(ns_) ns_set_state(ns_, (ns_)->state & (~NSE_S_ALIVE)); |
#define | ERR_IF_NSVC_USES_SNS(nsvc, reason) |
#define | CHECK_TX_RC(rc, nsvc) |
Functions | |
struct gprs_ns_hdr | __attribute__ ((packed)) |
static bool | nsvc_is_not_used (const struct gprs_nsvc *nsvc) |
struct msgb * | gprs_ns_msgb_alloc (void) |
static void | ns_set_state_with_log (struct gprs_nsvc *nsvc, uint32_t state, bool is_remote, const char *file, unsigned line) |
struct gprs_nsvc * | gprs_nsvc_by_nsvci (struct gprs_ns_inst *nsi, uint16_t nsvci) |
Lookup struct gprs_nsvc based on NSVCI. More... | |
struct gprs_nsvc * | gprs_nsvc_by_nsei (struct gprs_ns_inst *nsi, uint16_t nsei) |
Lookup struct gprs_nsvc based on NSEI. More... | |
static struct gprs_nsvc * | gprs_active_nsvc_by_nsei (struct gprs_ns_inst *nsi, uint16_t nsei, uint16_t bvci) |
Determine active NS-VC for given NSEI + BVCI. More... | |
struct gprs_nsvc * | gprs_nsvc_by_rem_addr (struct gprs_ns_inst *nsi, const struct sockaddr_in *sin) |
Lookup NS-VC based on specified remote peer socket addr. More... | |
static void | gprs_ns_timer_cb (void *data) |
struct gprs_nsvc * | gprs_nsvc_create2 (struct gprs_ns_inst *nsi, uint16_t nsvci, uint8_t sig_weight, uint8_t data_weight) |
Create a new NS-VC (Virtual Circuit) within given instance. More... | |
void | gprs_nsvc_delete (struct gprs_nsvc *nsvc) |
Delete given NS-VC. More... | |
static void | ns_osmo_signal_dispatch (struct gprs_nsvc *nsvc, unsigned int signal, uint8_t cause) |
static void | ns_osmo_signal_dispatch_mismatch (struct gprs_nsvc *nsvc, struct msgb *msg, uint8_t pdu_type, uint8_t ie_type) |
static void | ns_osmo_signal_dispatch_replaced (struct gprs_nsvc *nsvc, struct gprs_nsvc *old_nsvc) |
const char * | gprs_ns_cause_str (enum ns_cause cause) |
Obtain a human-readable string for NS cause value. More... | |
static int | nsip_sendmsg (struct gprs_nsvc *nsvc, struct msgb *msg) |
int | grps_ns_frgre_sendmsg (struct gprs_nsvc *nsvc, struct msgb *msg) |
static bool | ns_is_sns (uint8_t pdu_type) |
static int | gprs_ns_tx (struct gprs_nsvc *nsvc, struct msgb *msg) |
static int | gprs_ns_tx_simple (struct gprs_nsvc *nsvc, uint8_t pdu_type) |
int | gprs_ns_tx_reset (struct gprs_nsvc *nsvc, uint8_t cause) |
Transmit a NS-RESET on a given NSVC. More... | |
int | gprs_ns_tx_status (struct gprs_nsvc *nsvc, uint8_t cause, uint16_t bvci, struct msgb *orig_msg) |
Transmit a NS-STATUS on a given NSVC. More... | |
int | gprs_ns_tx_block (struct gprs_nsvc *nsvc, uint8_t cause) |
Transmit a NS-BLOCK on a given NS-VC. More... | |
static int | gprs_ns_tx_block_ack (struct gprs_nsvc *nsvc) |
Transmit a NS-BLOCK-ACK on a given NS-VC. More... | |
int | gprs_ns_tx_unblock (struct gprs_nsvc *nsvc) |
Transmit a NS-UNBLOCK on a given NS-VC. More... | |
int | gprs_ns_tx_alive (struct gprs_nsvc *nsvc) |
Transmit a NS-ALIVE on a given NS-VC. More... | |
int | gprs_ns_tx_alive_ack (struct gprs_nsvc *nsvc) |
Transmit a NS-ALIVE-ACK on a given NS-VC. More... | |
static void | nsvc_start_timer (struct gprs_nsvc *nsvc, enum nsvc_timer_mode mode) |
static int | nsvc_timer_elapsed_ms (struct gprs_nsvc *nsvc) |
static int | gprs_ns_tx_reset_ack (struct gprs_nsvc *nsvc) |
int | gprs_ns_tx_sns_ack (struct gprs_nsvc *nsvc, uint8_t trans_id, uint8_t *cause, const struct gprs_ns_ie_ip4_elem *ip4_elems, unsigned int num_ip4_elems) |
Encode + Transmit a SNS-ACK as per Section 9.3.1. More... | |
int | gprs_ns_tx_sns_config (struct gprs_nsvc *nsvc, bool end_flag, const struct gprs_ns_ie_ip4_elem *ip4_elems, unsigned int num_ip4_elems) |
Encode + Transmit a SNS-CONFIG as per Section 9.3.4. More... | |
int | gprs_ns_tx_sns_config_ack (struct gprs_nsvc *nsvc, uint8_t *cause) |
Encode + Transmit a SNS-CONFIG-ACK as per Section 9.3.5. More... | |
int | gprs_ns_tx_sns_size (struct gprs_nsvc *nsvc, bool reset_flag, uint16_t max_nr_nsvc, uint16_t *ip4_ep_nr, uint16_t *ip6_ep_nr) |
Encode + transmit a SNS-SIZE as per Section 9.3.7. More... | |
int | gprs_ns_tx_sns_size_ack (struct gprs_nsvc *nsvc, uint8_t *cause) |
Encode + Transmit a SNS-SIZE-ACK as per Section 9.3.8. More... | |
int | gprs_ns_sendmsg (struct gprs_ns_inst *nsi, struct msgb *msg) |
High-level function for transmitting a NS-UNITDATA messsage. More... | |
static int | gprs_ns_rx_unitdata (struct gprs_nsvc *nsvc, struct msgb *msg) |
static int | gprs_ns_rx_status (struct gprs_nsvc *nsvc, struct msgb *msg) |
static int | gprs_nsvc_replace_if_found (uint16_t nsvci, struct gprs_nsvc **nsvc, struct gprs_nsvc **old_nsvc) |
static int | gprs_ns_rx_reset (struct gprs_nsvc **nsvc, struct msgb *msg) |
static int | gprs_ns_rx_reset_ack (struct gprs_nsvc **nsvc, struct msgb *msg) |
static int | gprs_ns_rx_block (struct gprs_nsvc *nsvc, struct msgb *msg) |
int | gprs_ns_vc_create (struct gprs_ns_inst *nsi, struct msgb *msg, struct gprs_nsvc *fallback_nsvc, struct gprs_nsvc **new_nsvc) |
Create/get NS-VC independently from underlying transport layer. More... | |
int | gprs_ns_process_msg (struct gprs_ns_inst *nsi, struct msgb *msg, struct gprs_nsvc **nsvc) |
Process NS message independently from underlying transport layer. More... | |
int | gprs_ns_rcvmsg (struct gprs_ns_inst *nsi, struct msgb *msg, struct sockaddr_in *saddr, enum gprs_ns_ll ll) |
Receive incoming NS message from underlying transport layer. More... | |
char * | gprs_ns_ll_str_buf (char *buf, size_t buf_len, const struct gprs_nsvc *nsvc) |
const char * | gprs_ns_ll_str (const struct gprs_nsvc *nsvc) |
char * | gprs_ns_ll_str_c (const void *ctx, const struct gprs_nsvc *nsvc) |
void | gprs_ns_ll_copy (struct gprs_nsvc *nsvc, struct gprs_nsvc *other) |
void | gprs_ns_ll_clear (struct gprs_nsvc *nsvc) |
struct gprs_ns_inst * | gprs_ns_instantiate (gprs_ns_cb_t *cb, void *ctx) |
Create a new GPRS NS instance. More... | |
void | gprs_ns_close (struct gprs_ns_inst *nsi) |
void | gprs_ns_destroy (struct gprs_ns_inst *nsi) |
Destroy an entire NS instance. More... | |
static struct msgb * | read_nsip_msg (struct osmo_fd *bfd, int *error, struct sockaddr_in *saddr) |
static int | handle_nsip_read (struct osmo_fd *bfd) |
static int | handle_nsip_write (struct osmo_fd *bfd) |
static int | nsip_fd_cb (struct osmo_fd *bfd, unsigned int what) |
int | gprs_ns_nsip_listen (struct gprs_ns_inst *nsi) |
Create a listening socket for GPRS NS/UDP/IP. More... | |
int | gprs_nsvc_reset (struct gprs_nsvc *nsvc, uint8_t cause) |
Initiate a RESET procedure. More... | |
struct gprs_nsvc * | gprs_ns_nsip_connect (struct gprs_ns_inst *nsi, struct sockaddr_in *dest, uint16_t nsei, uint16_t nsvci) |
Establish a NS connection (from the BSS) to the SGSN. More... | |
struct gprs_nsvc * | gprs_ns_nsip_connect_sns (struct gprs_ns_inst *nsi, struct sockaddr_in *dest, uint16_t nsei, uint16_t nsvci) |
Establish a NS connection (from the BSS) to the SGSN using SNS auto-configuration. More... | |
void | gprs_ns_set_log_ss (int ss) |
char * | gprs_nsvc_state_append (char *s, struct gprs_nsvc *nsvc) |
Append the nsvc state to a talloc string. More... | |
void | gprs_nsvc_start_test (struct gprs_nsvc *nsvc) |
Start the ALIVE timer procedure in all NS-VCs part of this NS Instance. More... | |
void | gprs_start_alive_all_nsvcs (struct gprs_ns_inst *nsi) |
GPRS Networks Service (NS) messages on the Gb interface 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05)
Some introduction into NS: NS is used typically on top of frame relay, but in the ip.access world it is encapsulated in UDP packets. It serves as an intermediate shim betwen BSSGP and the underlying medium. It doesn't do much, apart from providing congestion notification and status indication.
Terms:
NS Network Service NSVC NS Virtual Connection NSEI NS Entity Identifier NSVL NS Virtual Link NSVLI NS Virtual Link Identifier BVC BSSGP Virtual Connection BVCI BSSGP Virtual Connection Identifier NSVCG NS Virtual Connection Goup Blocked NS-VC cannot be used for user traffic Alive Ability of a NS-VC to provide communication
There can be multiple BSSGP virtual connections over one (group of) NSVC's. BSSGP will therefore identify the BSSGP virtual connection by a BVCI passed down to NS. NS then has to figure out which NSVC's are responsible for this BVCI. Those mappings are administratively configured.
This implementation has the following limitations:
#define CHECK_TX_RC | ( | rc, | |
nsvc | |||
) |
Referenced by gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), and gprs_ns_vc_create().
#define ERR_IF_NSVC_USES_SNS | ( | nsvc, | |
reason | |||
) |
Referenced by gprs_ns_tx_block(), gprs_ns_tx_block_ack(), gprs_ns_tx_reset(), gprs_ns_tx_reset_ack(), gprs_ns_tx_unblock(), and gprs_nsvc_reset().
#define ns_mark_alive | ( | ns_ | ) | ns_set_state(ns_, (ns_)->state | NSE_S_ALIVE) |
Referenced by gprs_ns_process_msg().
#define ns_mark_blocked | ( | ns_ | ) | ns_set_state(ns_, (ns_)->state | NSE_S_BLOCKED) |
Referenced by gprs_ns_rx_block(), and gprs_ns_tx_block().
#define ns_mark_dead | ( | ns_ | ) | ns_set_state(ns_, (ns_)->state & (~NSE_S_ALIVE)); |
#define ns_mark_unblocked | ( | ns_ | ) | ns_set_state(ns_, (ns_)->state & (~NSE_S_BLOCKED)); |
Referenced by gprs_ns_process_msg().
#define ns_set_remote_state | ( | ns_, | |
st_ | |||
) | ns_set_state_with_log(ns_, st_, true, __FILE__, __LINE__) |
Referenced by gprs_ns_process_msg(), and gprs_ns_rx_reset_ack().
#define ns_set_state | ( | ns_, | |
st_ | |||
) | ns_set_state_with_log(ns_, st_, false, __FILE__, __LINE__) |
enum ns_cause |
NS Cause (TS 08.16, Section 10.3.2, Table 13)
enum ns_ctr |
enum ns_ctrl_ie |
enum ns_pdu_type |
NS PDU Type (TS 08.16, Section 10.3.7, Table 14)
enum ns_stat |
struct gprs_ns_hdr __attribute__ | ( | (packed) | ) |
|
static |
Determine active NS-VC for given NSEI + BVCI.
Use this function to determine which of the NS-VCs inside the NS Instance shall be used to transmit data for given NSEI + BVCI
References gprs_nsvc::data_weight, gprs_ns_inst::gprs_nsvcs, gprs_nsvc::list, llist_for_each_entry, NSE_S_ALIVE, NSE_S_BLOCKED, gprs_nsvc::nsei, gprs_nsvc::sig_weight, and gprs_nsvc::state.
Referenced by gprs_ns_sendmsg().
const char* gprs_ns_cause_str | ( | enum ns_cause | cause | ) |
Obtain a human-readable string for NS cause value.
References get_value_string(), grps_ns_frgre_sendmsg(), msg, and nsip_sendmsg().
Referenced by gprs_ns_rx_reset(), gprs_ns_rx_status(), gprs_ns_tx_block(), gprs_ns_tx_reset(), gprs_ns_tx_status(), gprs_sns_st_config_bss(), and gprs_sns_st_size().
void gprs_ns_close | ( | struct gprs_ns_inst * | nsi | ) |
void gprs_ns_destroy | ( | struct gprs_ns_inst * | nsi | ) |
Destroy an entire NS instance.
nsi | gprs_ns_inst that is to be destroyed |
This function releases all resources associated with the NS-instance.
References gprs_ns_close().
struct gprs_ns_inst* gprs_ns_instantiate | ( | gprs_ns_cb_t * | cb, |
void * | ctx | ||
) |
Create a new GPRS NS instance.
[in] | cb | Call-back function for incoming BSSGP data |
References gprs_ns_inst::cb, gprs_nsvc_create2(), gprs_ns_inst::gprs_nsvcs, gprs_sns_fsm_registered, gprs_sns_init(), INIT_LLIST_HEAD, gprs_nsvc::list, llist_del(), NS_TOUT_TNS_ALIVE, NS_TOUT_TNS_ALIVE_RETRIES, NS_TOUT_TNS_BLOCK, NS_TOUT_TNS_BLOCK_RETRIES, NS_TOUT_TNS_RESET, NS_TOUT_TNS_RESET_RETRIES, NS_TOUT_TNS_TEST, NS_TOUT_TSNS_PROV, gprs_ns_inst::nsip, gprs_nsvc::nsvci_is_valid, gprs_ns_inst::timeout, gprs_ns_inst::unknown_nsvc, and gprs_ns_inst::use_reset_block_unblock.
void gprs_ns_ll_clear | ( | struct gprs_nsvc * | nsvc | ) |
References gprs_nsvc::frgre, GPRS_NS_LL_FR_GRE, GPRS_NS_LL_UDP, gprs_nsvc::ip, and gprs_nsvc::ll.
Referenced by gprs_ns_rx_reset(), and gprs_ns_rx_reset_ack().
References gprs_nsvc::frgre, GPRS_NS_LL_FR_GRE, GPRS_NS_LL_UDP, gprs_nsvc::ip, and gprs_nsvc::ll.
Referenced by gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), and gprs_ns_vc_create().
const char* gprs_ns_ll_str | ( | const struct gprs_nsvc * | nsvc | ) |
References gprs_ns_ll_str_buf().
Referenced by create_missing_nsvcs(), do_sns_add(), do_sns_change_weight(), do_sns_delete(), dump_nse(), gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), gprs_ns_vc_create(), and gprs_nsvc_replace_if_found().
char* gprs_ns_ll_str_buf | ( | char * | buf, |
size_t | buf_len, | ||
const struct gprs_nsvc * | nsvc | ||
) |
References gprs_nsvc::frgre, GPRS_NS_LL_FR_GRE, GPRS_NS_LL_UDP, gprs_nsvc::ip, gprs_nsvc::ll, and osmo_ntohs.
Referenced by gprs_ns_ll_str(), and gprs_ns_ll_str_c().
char* gprs_ns_ll_str_c | ( | const void * | ctx, |
const struct gprs_nsvc * | nsvc | ||
) |
References gprs_ns_ll_str_buf().
struct msgb* gprs_ns_msgb_alloc | ( | void | ) |
References DNS, LOGL_ERROR, LOGP, msg, msgb_alloc_headroom(), NS_ALLOC_HEADROOM, and NS_ALLOC_SIZE.
Referenced by gprs_ns_tx_block(), gprs_ns_tx_block_ack(), gprs_ns_tx_reset(), gprs_ns_tx_reset_ack(), gprs_ns_tx_simple(), gprs_ns_tx_sns_ack(), gprs_ns_tx_sns_config(), gprs_ns_tx_sns_config_ack(), gprs_ns_tx_sns_size(), gprs_ns_tx_sns_size_ack(), gprs_ns_tx_status(), and read_nsip_msg().
struct gprs_nsvc* gprs_ns_nsip_connect | ( | struct gprs_ns_inst * | nsi, |
struct sockaddr_in * | dest, | ||
uint16_t | nsei, | ||
uint16_t | nsvci | ||
) |
Establish a NS connection (from the BSS) to the SGSN.
nsi | NS-instance | |
[in] | dest | Destination IP/Port |
[in] | nsei | NSEI of the to-be-established NS-VC |
[in] | nsvci | NSVCI of the to-be-established NS-VC |
This function will establish a single NS/UDP/IP connection in uplink (BSS to SGSN) direction.
References gprs_nsvc_by_rem_addr(), gprs_nsvc_create2(), gprs_nsvc_reset(), gprs_nsvc::ip, NS_CAUSE_OM_INTERVENTION, nsei, gprs_nsvc::nsei, and gprs_nsvc::remote_end_is_sgsn.
struct gprs_nsvc* gprs_ns_nsip_connect_sns | ( | struct gprs_ns_inst * | nsi, |
struct sockaddr_in * | dest, | ||
uint16_t | nsei, | ||
uint16_t | nsvci | ||
) |
Establish a NS connection (from the BSS) to the SGSN using SNS auto-configuration.
nsi | NS-instance | |
[in] | dest | Destination IP/Port |
[in] | nsei | NSEI of the to-be-established NS-VC |
[in] | nsvci | NSVCI of the to-be-established NS-VC |
This function will establish a single NS/UDP/IP connection in uplink (BSS to SGSN) direction. It will start with the SNS-SIZE procedure, followed by BSS-originated SNS-CONFIG, then SGSN-originated SNS-CONFIG.
Once configuration completes, the user will be notified by the S_SNS_CONFIGURED signal, at which point he typically would want to initiate NS-RESET by means of gprs_nsvc_reset().
References gprs_ns_inst::bss_sns_fi, gprs_nsvc_by_rem_addr(), gprs_nsvc_create2(), gprs_sns_bss_fsm_alloc(), gprs_sns_bss_fsm_start(), gprs_nsvc::ip, ns_set_state, nsei, gprs_nsvc::nsei, osmo_fsm_inst_term, OSMO_FSM_TERM_REQUEST, and gprs_nsvc::remote_end_is_sgsn.
int gprs_ns_nsip_listen | ( | struct gprs_ns_inst * | nsi | ) |
Create a listening socket for GPRS NS/UDP/IP.
[in] | nsi | NS protocol instance to listen |
A call to this function will create a UDP socket bound to the port number and IP address specified in the NS protocol instance. The file descriptor of the socket will be stored in nsi->nsip.fd.
References osmo_fd::cb, osmo_fd::data, DNS, gprs_ns_inst::dscp, osmo_fd::fd, gprs_ns_inst::fd, gprs_ns_inst::local_ip, gprs_ns_inst::local_port, LOGL_ERROR, LOGL_NOTICE, LOGP, gprs_ns_inst::nsip, nsip_fd_cb(), osmo_htonl, OSMO_SOCK_F_BIND, OSMO_SOCK_F_CONNECT, osmo_sock_init2_ofd(), osmo_sock_init_ofd(), gprs_ns_inst::remote_ip, and gprs_ns_inst::remote_port.
int gprs_ns_process_msg | ( | struct gprs_ns_inst * | nsi, |
struct msgb * | msg, | ||
struct gprs_nsvc ** | nsvc | ||
) |
Process NS message independently from underlying transport layer.
nsi | NS instance to which the data belongs | |
[in] | msg | message buffer containing newly-received data |
[in,out] | nsvc | refers to the virtual connection, may be modified when processing a NS_RESET |
This contains the main NS automaton.
References gprs_ns_inst::bss_sns_fi, gprs_ns_hdr::data, DNS, get_value_string(), gprs_ns_rx_block(), gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), gprs_ns_rx_sns(), gprs_ns_rx_status(), gprs_ns_rx_unitdata(), gprs_ns_tx_alive_ack(), gprs_ns_tx_simple(), gprs_ns_tx_status(), gprs_ns_tx_unblock(), gprs_nsvc_reset(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGL_NOTICE, LOGP, LOGPC, msgb_hexdump(), msgb_l2len(), msgb_nsei, NS_CAUSE_PDU_INCOMP_PSTATE, NS_CAUSE_PROTO_ERR_UNSPEC, NS_CTR_BYTES_IN, NS_CTR_PKTS_IN, NS_IE_NSEI, NS_IE_TRANS_ID, ns_is_sns(), ns_mark_alive, ns_mark_unblocked, ns_osmo_signal_dispatch(), NS_PDUT_ALIVE, NS_PDUT_ALIVE_ACK, NS_PDUT_BLOCK, NS_PDUT_BLOCK_ACK, NS_PDUT_RESET, NS_PDUT_RESET_ACK, NS_PDUT_STATUS, NS_PDUT_UNBLOCK, NS_PDUT_UNBLOCK_ACK, NS_PDUT_UNITDATA, ns_set_remote_state, ns_set_state, NS_STAT_ALIVE_DELAY, NSE_S_ALIVE, NSE_S_BLOCKED, NSE_S_RESET, nsvc_is_not_used(), nsvc_start_timer(), nsvc_timer_elapsed_ms(), NSVC_TIMER_TNS_ALIVE, NSVC_TIMER_TNS_TEST, osmo_stat_item_set(), gprs_ns_hdr::pdu_type, rate_ctr_add(), rate_ctr_inc(), S_NS_UNBLOCK, SNS_PDUT_ACK, SNS_PDUT_ADD, SNS_PDUT_CHANGE_WEIGHT, SNS_PDUT_CONFIG, SNS_PDUT_CONFIG_ACK, SNS_PDUT_DELETE, SNS_PDUT_SIZE, SNS_PDUT_SIZE_ACK, and tlv_parse().
Referenced by gprs_ns_rcvmsg(), and gprs_ns_rx_block().
int gprs_ns_rcvmsg | ( | struct gprs_ns_inst * | nsi, |
struct msgb * | msg, | ||
struct sockaddr_in * | saddr, | ||
enum gprs_ns_ll | ll | ||
) |
Receive incoming NS message from underlying transport layer.
nsi | NS instance to which the data belongs | |
[in] | msg | message buffer containing newly-received data |
[in] | saddr | socketaddr from which data was received |
[in] | ll | link-layer type in which data was received |
This is the main entry point int othe NS imlementation where frames from the underlying transport (normally UDP) enter.
References gprs_ns_process_msg(), gprs_ns_vc_create(), gprs_nsvc_by_rem_addr(), gprs_nsvc::ip, gprs_nsvc::ll, LOG_CTX_GB_NSVC, log_set_context(), and gprs_ns_inst::unknown_nsvc.
Referenced by handle_nsfrgre_read(), handle_nsip_read(), and read_nsfrgre_msg().
References cause, rate_ctr_group::ctr, gprs_nsvc::ctrg, gprs_ns_hdr::data, DNS, gprs_ns_process_msg(), gprs_ns_tx_block_ack(), gprs_ns_tx_status(), gprs_ns_vc_create(), msgb::l2h, LOGL_ERROR, LOGL_INFO, LOGP, msgb_l2len(), NS_CAUSE_MISSING_ESSENT_IE, NS_CTR_BLOCKED, NS_IE_CAUSE, NS_IE_VCI, ns_mark_blocked, ns_osmo_signal_dispatch(), gprs_nsvc::nsei, rate_ctr_inc(), S_NS_BLOCK, tlv_parse(), TLVP_PRESENT, and TLVP_VAL.
Referenced by gprs_ns_process_msg().
References cause, CHECK_TX_RC, gprs_ns_hdr::data, DNS, gprs_ns_cause_str(), gprs_ns_ll_clear(), gprs_ns_ll_copy(), gprs_ns_ll_str(), gprs_ns_tx_reset_ack(), gprs_ns_tx_status(), gprs_nsvc_create2(), gprs_nsvc_replace_if_found(), gprs_nsvc_start_test(), msgb::l2h, LOGL_ERROR, LOGL_INFO, LOGP, msgb_l2len(), NS_CAUSE_MISSING_ESSENT_IE, NS_CTR_INV_NSEI, NS_CTR_INV_VCI, NS_CTR_NSEI_CHG, NS_CTR_REPLACED, NS_IE_CAUSE, NS_IE_NSEI, NS_IE_VCI, ns_osmo_signal_dispatch(), ns_osmo_signal_dispatch_mismatch(), ns_osmo_signal_dispatch_replaced(), NS_PDUT_RESET, ns_set_state, NSE_S_ALIVE, NSE_S_BLOCKED, nsei, osmo_stat_item_group_udp_idx(), rate_ctr_group_upd_idx(), rate_ctr_inc(), S_NS_RESET, tlv_parse(), TLVP_PRESENT, TLVP_VAL, and tlvp_val16be().
Referenced by gprs_ns_process_msg().
References CHECK_TX_RC, gprs_ns_hdr::data, DNS, gprs_ns_ll_clear(), gprs_ns_ll_copy(), gprs_ns_ll_str(), gprs_ns_tx_status(), gprs_nsvc_replace_if_found(), gprs_nsvc_start_test(), msgb::l2h, LOGL_ERROR, LOGL_INFO, LOGL_NOTICE, LOGP, msgb_l2len(), NS_CAUSE_MISSING_ESSENT_IE, NS_CTR_BLOCKED, NS_CTR_INV_NSEI, NS_CTR_INV_VCI, NS_CTR_NSEI_CHG, NS_CTR_REPLACED, NS_IE_NSEI, NS_IE_VCI, ns_osmo_signal_dispatch_mismatch(), ns_osmo_signal_dispatch_replaced(), NS_PDUT_RESET_ACK, ns_set_remote_state, ns_set_state, NSE_S_ALIVE, NSE_S_BLOCKED, NSE_S_RESET, nsei, osmo_timer_del(), rate_ctr_inc(), tlv_parse(), TLVP_PRESENT, and tlvp_val16be().
Referenced by gprs_ns_process_msg().
References cause, gprs_ns_hdr::data, DNS, gprs_ns_cause_str(), msgb::l2h, LOGL_ERROR, LOGL_INFO, LOGL_NOTICE, LOGP, LOGPC, msgb_l2len(), NS_IE_CAUSE, gprs_nsvc::nsei, tlv_parse(), TLVP_PRESENT, and TLVP_VAL.
Referenced by gprs_ns_process_msg().
References bvci, gprs_ns_inst::cb, gprs_ns_hdr::data, GPRS_NS_EVT_UNIT_DATA, gprs_ns_tx_status(), if(), msgb::l2h, msgb_bssgph, msgb_bvci, NS_CAUSE_NSVC_BLOCKED, NSE_S_BLOCKED, gprs_nsvc::nsi, and gprs_nsvc::state.
Referenced by gprs_ns_process_msg().
int gprs_ns_sendmsg | ( | struct gprs_ns_inst * | nsi, |
struct msgb * | msg | ||
) |
High-level function for transmitting a NS-UNITDATA messsage.
[in] | nsi | NS-instance on which we shall transmit |
[in] | msg | struct msgb to be trasnmitted |
This function obtains the NS-VC by the msgb_nsei(msg) and then checks if the NS-VC is ALIVE and not BLOCKED. After that, it adds a NS header for the NS-UNITDATA message type and sends it off.
Section 9.2.10: transmit side / NS-UNITDATA-REQUEST primitive
References bvci, gprs_ns_hdr::data, DNS, gprs_active_nsvc_by_nsei(), gprs_ns_tx(), gprs_nsvc_by_nsei(), if(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msgb_bvci, msgb_free(), msgb_nsei, msgb_push(), NS_PDUT_UNITDATA, and gprs_ns_hdr::pdu_type.
Referenced by _gprs_ns_sendmsg().
void gprs_ns_set_log_ss | ( | int | ss | ) |
References DNS.
|
static |
References _NSVC_TIMER_NR, gprs_nsvc::alive_retries, gprs_ns_inst::bss_sns_fi, rate_ctr_group::ctr, gprs_nsvc::ctrg, data, DEBUGP, DNS, get_value_string(), gprs_ns_tx_alive(), gprs_ns_tx_reset(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_NOTICE, LOGP, NS_CAUSE_NSVC_BLOCKED, NS_CAUSE_OM_INTERVENTION, NS_CTR_BLOCKED, NS_CTR_DEAD, NS_CTR_LOST_ALIVE, NS_CTR_LOST_RESET, ns_osmo_signal_dispatch(), ns_set_state, NS_TOUT_TNS_ALIVE_RETRIES, NSE_S_BLOCKED, NSE_S_RESET, gprs_nsvc::nsei, gprs_nsvc::nsi, gprs_ns_inst::nsip, nsvc_start_timer(), NSVC_TIMER_TNS_ALIVE, NSVC_TIMER_TNS_RESET, NSVC_TIMER_TNS_TEST, rate_ctr_inc(), S_NS_ALIVE_EXP, S_NS_BLOCK, gprs_nsvc::state, gprs_ns_inst::timeout, gprs_nsvc::timer_mode, timer_mode_tout, and gprs_ns_inst::use_reset_block_unblock.
Referenced by gprs_nsvc_by_rem_addr(), and gprs_nsvc_create2().
References rate_ctr_group::ctr, gprs_nsvc::ctrg, DNS, get_value_string(), gprs_ns_frgre_sendmsg(), GPRS_NS_LL_FR_GRE, GPRS_NS_LL_UDP, msgb::l2h, gprs_nsvc::ll, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGL_INFO, LOGL_NOTICE, LOGP, msgb_free(), msgb_l2len(), NS_CTR_BYTES_OUT, NS_CTR_PKTS_OUT, ns_is_sns(), NS_PDUT_STATUS, nsip_sendmsg(), nsvc_is_not_used(), gprs_ns_hdr::pdu_type, rate_ctr_add(), and rate_ctr_inc().
Referenced by gprs_ns_sendmsg(), gprs_ns_tx_block(), gprs_ns_tx_block_ack(), gprs_ns_tx_reset(), gprs_ns_tx_reset_ack(), gprs_ns_tx_simple(), gprs_ns_tx_sns_ack(), gprs_ns_tx_sns_config(), gprs_ns_tx_sns_config_ack(), gprs_ns_tx_sns_size(), gprs_ns_tx_sns_size_ack(), and gprs_ns_tx_status().
int gprs_ns_tx_alive | ( | struct gprs_nsvc * | nsvc | ) |
Transmit a NS-ALIVE on a given NS-VC.
[in] | nsvc | NS-VC on which the NS-ALIVE is to be transmitted |
References DNS, gprs_ns_tx_simple(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_DEBUG, LOGP, NS_PDUT_ALIVE, gprs_nsvc::nsei, and gprs_nsvc::nsvci.
Referenced by gprs_ns_timer_cb(), and gprs_nsvc_start_test().
int gprs_ns_tx_alive_ack | ( | struct gprs_nsvc * | nsvc | ) |
Transmit a NS-ALIVE-ACK on a given NS-VC.
[in] | nsvc | NS-VC on which the NS-ALIVE-ACK is to be transmitted |
References DNS, gprs_ns_tx_simple(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_DEBUG, LOGP, NS_PDUT_ALIVE_ACK, gprs_nsvc::nsei, and gprs_nsvc::nsvci.
Referenced by gprs_ns_process_msg().
int gprs_ns_tx_block | ( | struct gprs_nsvc * | nsvc, |
uint8_t | cause | ||
) |
Transmit a NS-BLOCK on a given NS-VC.
[in] | nsvc | NS-VC on which the NS-BLOCK is to be transmitted |
[in] | cause | Numeric NS Cause value |
References rate_ctr_group::ctr, gprs_nsvc::ctrg, DNS, ERR_IF_NSVC_USES_SNS, gprs_ns_cause_str(), gprs_ns_msgb_alloc(), gprs_ns_tx(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGP, msgb_put(), msgb_tvlv_put(), NS_CTR_BLOCKED, NS_IE_CAUSE, NS_IE_VCI, ns_mark_blocked, NS_PDUT_BLOCK, gprs_nsvc::nsei, gprs_nsvc::nsvci, osmo_htons, gprs_ns_hdr::pdu_type, and rate_ctr_inc().
Referenced by DEFUN().
|
static |
Transmit a NS-BLOCK-ACK on a given NS-VC.
[in] | nsvc | NS-VC on which the NS-BLOCK is to be transmitted |
References DNS, ERR_IF_NSVC_USES_SNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGP, msgb_put(), msgb_tvlv_put(), NS_IE_VCI, NS_PDUT_BLOCK_ACK, gprs_nsvc::nsei, gprs_nsvc::nsvci, osmo_htons, and gprs_ns_hdr::pdu_type.
Referenced by gprs_ns_rx_block().
int gprs_ns_tx_reset | ( | struct gprs_nsvc * | nsvc, |
uint8_t | cause | ||
) |
Transmit a NS-RESET on a given NSVC.
[in] | nsvc | NS-VC used for transmission [in] cause Numeric NS cause value |
References DNS, ERR_IF_NSVC_USES_SNS, gprs_ns_cause_str(), gprs_ns_msgb_alloc(), gprs_ns_tx(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGP, msgb_put(), msgb_tvlv_put(), NS_IE_CAUSE, NS_IE_NSEI, NS_IE_VCI, NS_PDUT_RESET, nsei, gprs_nsvc::nsei, gprs_nsvc::nsvci, osmo_htons, and gprs_ns_hdr::pdu_type.
Referenced by gprs_ns_timer_cb(), and gprs_nsvc_reset().
|
static |
References DNS, ERR_IF_NSVC_USES_SNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGP, msgb_put(), msgb_tvlv_put(), NS_IE_NSEI, NS_IE_VCI, NS_PDUT_RESET_ACK, nsei, gprs_nsvc::nsei, gprs_nsvc::nsvci, osmo_htons, and gprs_ns_hdr::pdu_type.
Referenced by gprs_ns_rx_reset().
|
static |
References gprs_ns_msgb_alloc(), gprs_ns_tx(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), msgb_put(), and gprs_ns_hdr::pdu_type.
Referenced by gprs_ns_process_msg(), gprs_ns_tx_alive(), gprs_ns_tx_alive_ack(), and gprs_ns_tx_unblock().
int gprs_ns_tx_sns_ack | ( | struct gprs_nsvc * | nsvc, |
uint8_t | trans_id, | ||
uint8_t * | cause, | ||
const struct gprs_ns_ie_ip4_elem * | ip4_elems, | ||
unsigned int | num_ip4_elems | ||
) |
Encode + Transmit a SNS-ACK as per Section 9.3.1.
[in] | nsvc | NS-VC through which to transmit the ACK |
[in] | trans_id | Transaction ID which to acknowledge |
[in] | cause | Pointer to cause value (NULL if no cause to be sent) |
[in] | ip4_elems | Array of IPv4 Elements |
[in] | num_ip4_elems | number of ip4_elems |
References gprs_ns_inst::bss_sns_fi, DNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msgb_free(), msgb_put(), msgb_tvlv_put(), msgb_v_put(), NS_IE_CAUSE, NS_IE_IPv4_LIST, NS_IE_NSEI, nsei, gprs_nsvc::nsei, gprs_nsvc::nsi, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_ACK.
Referenced by gprs_sns_st_configured().
int gprs_ns_tx_sns_config | ( | struct gprs_nsvc * | nsvc, |
bool | end_flag, | ||
const struct gprs_ns_ie_ip4_elem * | ip4_elems, | ||
unsigned int | num_ip4_elems | ||
) |
Encode + Transmit a SNS-CONFIG as per Section 9.3.4.
[in] | nsvc | NS-VC through which to transmit the SNS-CONFIG |
[in] | end_flag | Whether or not this is the last SNS-CONFIG |
[in] | ip4_elems | Array of IPv4 Elements |
[in] | num_ip4_elems | number of ip4_elems |
References gprs_ns_inst::bss_sns_fi, DNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msgb_free(), msgb_put(), msgb_tvlv_put(), msgb_v_put(), NS_IE_IPv4_LIST, NS_IE_NSEI, nsei, gprs_nsvc::nsei, gprs_nsvc::nsi, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_CONFIG.
Referenced by gprs_sns_st_config_bss_onenter().
int gprs_ns_tx_sns_config_ack | ( | struct gprs_nsvc * | nsvc, |
uint8_t * | cause | ||
) |
Encode + Transmit a SNS-CONFIG-ACK as per Section 9.3.5.
[in] | nsvc | NS-VC through which to transmit the SNS-CONFIG-ACK |
[in] | cause | Pointer to cause value (NULL if no cause to be sent) |
References gprs_ns_inst::bss_sns_fi, DNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msgb_free(), msgb_put(), msgb_tvlv_put(), NS_IE_CAUSE, NS_IE_NSEI, nsei, gprs_nsvc::nsei, gprs_nsvc::nsi, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_CONFIG_ACK.
Referenced by gprs_sns_st_config_sgsn().
int gprs_ns_tx_sns_size | ( | struct gprs_nsvc * | nsvc, |
bool | reset_flag, | ||
uint16_t | max_nr_nsvc, | ||
uint16_t * | ip4_ep_nr, | ||
uint16_t * | ip6_ep_nr | ||
) |
Encode + transmit a SNS-SIZE as per Section 9.3.7.
[in] | nsvc | NS-VC through which to transmit the SNS-SIZE |
[in] | reset_flag | Whether or not to add a RESET flag |
[in] | max_nr_nsvc | Maximum number of NS-VCs |
[in] | ip4_ep_nr | Number of IPv4 endpoints (NULL if none) |
[in] | ip6_ep_nr | Number of IPv6 endpoints (NULL if none) |
References gprs_ns_inst::bss_sns_fi, DNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msgb_free(), msgb_put(), msgb_tv16_put(), msgb_tv_put(), msgb_tvlv_put(), NS_IE_IPv4_EP_NR, NS_IE_IPv6_EP_NR, NS_IE_MAX_NR_NSVC, NS_IE_NSEI, NS_IE_RESET_FLAG, nsei, gprs_nsvc::nsei, gprs_nsvc::nsi, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_SIZE.
Referenced by gprs_sns_st_size_onenter().
int gprs_ns_tx_sns_size_ack | ( | struct gprs_nsvc * | nsvc, |
uint8_t * | cause | ||
) |
Encode + Transmit a SNS-SIZE-ACK as per Section 9.3.8.
[in] | nsvc | NS-VC through which to transmit the SNS-SIZE-ACK |
[in] | cause | Pointer to cause value (NULL if no cause to be sent) |
References gprs_ns_inst::bss_sns_fi, DNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msgb_free(), msgb_put(), msgb_tvlv_put(), NS_IE_CAUSE, NS_IE_NSEI, nsei, gprs_nsvc::nsei, gprs_nsvc::nsi, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_SIZE_ACK.
int gprs_ns_tx_status | ( | struct gprs_nsvc * | nsvc, |
uint8_t | cause, | ||
uint16_t | bvci, | ||
struct msgb * | orig_msg | ||
) |
Transmit a NS-STATUS on a given NSVC.
[in] | nsvc | NS-VC to be used for transmission |
[in] | cause | Numeric NS cause value |
[in] | bvci | BVCI to be reset within NSVC |
[in] | orig_msg | message causing the STATUS |
References DNS, gprs_ns_cause_str(), gprs_ns_msgb_alloc(), gprs_ns_tx(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_NOTICE, LOGP, msgb_l2len(), msgb_put(), msgb_tvlv_put(), NS_CAUSE_BVCI_UNKNOWN, NS_CAUSE_INVAL_ESSENT_IE, NS_CAUSE_MISSING_ESSENT_IE, NS_CAUSE_NSVC_BLOCKED, NS_CAUSE_NSVC_UNKNOWN, NS_CAUSE_PDU_INCOMP_PSTATE, NS_CAUSE_PROTO_ERR_UNSPEC, NS_CAUSE_SEM_INCORR_PDU, NS_IE_CAUSE, NS_IE_PDU, NS_IE_VCI, NS_PDUT_STATUS, gprs_nsvc::nsei, gprs_nsvc::nsvci, osmo_htons, and gprs_ns_hdr::pdu_type.
Referenced by gprs_ns_process_msg(), gprs_ns_rx_block(), gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), gprs_ns_rx_unitdata(), and gprs_ns_vc_create().
int gprs_ns_tx_unblock | ( | struct gprs_nsvc * | nsvc | ) |
Transmit a NS-UNBLOCK on a given NS-VC.
[in] | nsvc | NS-VC on which the NS-UNBLOCK is to be transmitted |
References DNS, ERR_IF_NSVC_USES_SNS, gprs_ns_tx_simple(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGP, NS_PDUT_UNBLOCK, gprs_nsvc::nsei, and gprs_nsvc::nsvci.
Referenced by DEFUN(), and gprs_ns_process_msg().
int gprs_ns_vc_create | ( | struct gprs_ns_inst * | nsi, |
struct msgb * | msg, | ||
struct gprs_nsvc * | fallback_nsvc, | ||
struct gprs_nsvc ** | new_nsvc | ||
) |
Create/get NS-VC independently from underlying transport layer.
nsi | NS instance to which the data belongs | |
[in] | msg | message buffer containing newly-received data |
[in] | fallback_nsvc | is used to send error messages back to the peer and to initialise the ll info of a created NS-VC object |
[out] | new_nsvc | contains a pointer to a NS-VC object if one has been created or found |
This contains the initial NS automaton state (NS-VC not yet attached).
References CHECK_TX_RC, gprs_ns_hdr::data, DNS, get_value_string(), GPRS_NS_CS_CREATED, GPRS_NS_CS_FOUND, GPRS_NS_CS_REJECTED, GPRS_NS_CS_SKIPPED, gprs_ns_ll_copy(), gprs_ns_ll_str(), gprs_ns_tx_status(), gprs_nsvc_by_nsvci(), gprs_nsvc_create2(), if(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGL_INFO, LOGL_NOTICE, LOGP, msgb_l2len(), NS_CAUSE_MISSING_ESSENT_IE, NS_CAUSE_PDU_INCOMP_PSTATE, NS_CTR_NSEI_CHG, NS_IE_CAUSE, NS_IE_NSEI, NS_IE_VCI, NS_PDUT_ALIVE_ACK, NS_PDUT_RESET, NS_PDUT_RESET_ACK, NS_PDUT_STATUS, ns_set_state, NSE_S_ALIVE, nsei, gprs_nsvc::nsei, gprs_nsvc::nsvci, gprs_nsvc::nsvci_is_valid, gprs_ns_hdr::pdu_type, rate_ctr_inc(), tlv_parse(), TLVP_PRESENT, and tlvp_val16be().
Referenced by gprs_ns_rcvmsg(), and gprs_ns_rx_block().
struct gprs_nsvc* gprs_nsvc_by_nsei | ( | struct gprs_ns_inst * | nsi, |
uint16_t | nsei | ||
) |
Lookup struct gprs_nsvc based on NSEI.
[in] | nsi | NS instance in which to search |
[in] | nsei | NSEI to be searched |
References gprs_ns_inst::gprs_nsvcs, gprs_nsvc::list, llist_for_each_entry, and gprs_nsvc::nsei.
Referenced by DEFUN(), and gprs_ns_sendmsg().
struct gprs_nsvc* gprs_nsvc_by_nsvci | ( | struct gprs_ns_inst * | nsi, |
uint16_t | nsvci | ||
) |
Lookup struct gprs_nsvc based on NSVCI.
[in] | nsi | NS instance in which to search |
[in] | nsvci | NSVCI to be searched |
References gprs_ns_inst::gprs_nsvcs, gprs_nsvc::list, llist_for_each_entry, and gprs_nsvc::nsvci.
Referenced by DEFUN(), gprs_ns_vc_create(), gprs_nsvc_create2(), and gprs_nsvc_replace_if_found().
struct gprs_nsvc* gprs_nsvc_by_rem_addr | ( | struct gprs_ns_inst * | nsi, |
const struct sockaddr_in * | sin | ||
) |
Lookup NS-VC based on specified remote peer socket addr.
[in] | nsi | NS Instance within which we shall look up the NS-VC |
[in] | sin | Remote peer Socket Address (IP + UDP Port) |
References data, gprs_ns_timer_cb(), gprs_ns_inst::gprs_nsvcs, gprs_nsvc::ip, gprs_nsvc::list, and llist_for_each_entry.
Referenced by gprs_ns_nsip_connect(), gprs_ns_nsip_connect_sns(), gprs_ns_rcvmsg(), and nsvc_by_ip4_elem().
struct gprs_nsvc* gprs_nsvc_create2 | ( | struct gprs_ns_inst * | nsi, |
uint16_t | nsvci, | ||
uint8_t | sig_weight, | ||
uint8_t | data_weight | ||
) |
Create a new NS-VC (Virtual Circuit) within given instance.
[in] | nsi | NS Instance in which to create the NSVC |
[in] | nsvci] | NS Virtual Connection Identifier for this NSVC |
[in] | sig_weight | Signalling Weight of this NS-VC. Use "0" for no signalling |
[in] | data_weight | Data WEight of this NS-VC. Use "0" for no data |
References gprs_ns_inst::bss_sns_fi, gprs_nsvc::ctrg, gprs_nsvc::data_weight, data_weight, DNS, gprs_ns_timer_cb(), gprs_nsvc_by_nsvci(), gprs_ns_inst::gprs_nsvcs, gprs_nsvc::list, llist_add(), LOGL_ERROR, LOGL_INFO, LOGP, ns_set_state, NSE_S_BLOCKED, gprs_nsvc::nsi, gprs_ns_inst::nsip, gprs_nsvc::nsvci, gprs_nsvc::nsvci_is_valid, osmo_stat_item_group_alloc(), osmo_timer_setup(), rate_ctr_group_alloc(), gprs_nsvc::sig_weight, sig_weight, gprs_nsvc::statg, gprs_nsvc::timer, and gprs_ns_inst::use_reset_block_unblock.
Referenced by DEFUN(), gprs_ns_instantiate(), gprs_ns_nsip_connect(), gprs_ns_nsip_connect_sns(), gprs_ns_rx_reset(), gprs_ns_vc_create(), and gprs_nsvc_create_ip4().
void gprs_nsvc_delete | ( | struct gprs_nsvc * | nsvc | ) |
Delete given NS-VC.
[in] | nsvc | gprs_nsvc to be deleted |
References gprs_nsvc::ctrg, gprs_nsvc::list, llist_del(), osmo_stat_item_group_free(), osmo_timer_del(), osmo_timer_pending(), rate_ctr_group_free(), gprs_nsvc::statg, and gprs_nsvc::timer.
Referenced by do_sns_delete(), and gprs_ns_close().
|
static |
References DNS, gprs_ns_ll_str(), gprs_nsvc_by_nsvci(), LOGL_INFO, and LOGP.
Referenced by gprs_ns_rx_reset(), and gprs_ns_rx_reset_ack().
int gprs_nsvc_reset | ( | struct gprs_nsvc * | nsvc, |
uint8_t | cause | ||
) |
Initiate a RESET procedure.
[in] | nsvc | NS-VC in which to start the procedure |
[in] | cause | Numeric NS cause value |
This is a high-level function initiating a NS-RESET procedure. It will not only send a NS-RESET, but also set the state to BLOCKED and start the Tns-reset timer.
References DNS, ERR_IF_NSVC_USES_SNS, gprs_ns_tx_reset(), LOGL_ERROR, LOGL_INFO, LOGP, ns_set_state, NSE_S_BLOCKED, NSE_S_RESET, gprs_nsvc::nsei, nsvc_start_timer(), and NSVC_TIMER_TNS_RESET.
Referenced by DEFUN(), gprs_ns_nsip_connect(), and gprs_ns_process_msg().
void gprs_nsvc_start_test | ( | struct gprs_nsvc * | nsvc | ) |
Start the ALIVE timer procedure in all NS-VCs part of this NS Instance.
References gprs_ns_tx_alive(), nsvc_is_not_used(), nsvc_start_timer(), and NSVC_TIMER_TNS_TEST.
Referenced by do_sns_add(), gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), and gprs_start_alive_all_nsvcs().
char* gprs_nsvc_state_append | ( | char * | s, |
struct gprs_nsvc * | nsvc | ||
) |
Append the nsvc state to a talloc string.
s | The string to append to (allocated with talloc) | |
[in] | nsvc | The NS-VC to print the state of |
This function will append a comma-separated state of the NS-VC to the string. The string needs to be allocated with talloc (e.g. talloc_strdup)
References NS_DESC_A, NS_DESC_B, gprs_nsvc::nsei, gprs_nsvc::nsvci, gprs_nsvc::remote_end_is_sgsn, gprs_nsvc::remote_state, and gprs_nsvc::state.
void gprs_start_alive_all_nsvcs | ( | struct gprs_ns_inst * | nsi | ) |
References gprs_nsvc_start_test(), gprs_ns_inst::gprs_nsvcs, gprs_nsvc::list, and llist_for_each_entry.
Referenced by gprs_sns_st_config_sgsn().
Referenced by gprs_ns_cause_str().
|
static |
References osmo_fd::data, GPRS_NS_LL_UDP, gprs_ns_rcvmsg(), msgb_free(), and read_nsip_msg().
Referenced by nsip_fd_cb().
|
static |
Referenced by nsip_fd_cb().
|
static |
References SNS_PDUT_ACK, SNS_PDUT_ADD, SNS_PDUT_CHANGE_WEIGHT, SNS_PDUT_CONFIG, SNS_PDUT_CONFIG_ACK, SNS_PDUT_DELETE, SNS_PDUT_SIZE, and SNS_PDUT_SIZE_ACK.
Referenced by gprs_ns_process_msg(), and gprs_ns_tx().
|
static |
References ns_signal_data::cause, ns_signal_data::nsvc, osmo_signal_dispatch(), and SS_L_NS.
Referenced by gprs_ns_process_msg(), gprs_ns_rx_block(), gprs_ns_rx_reset(), and gprs_ns_timer_cb().
|
static |
References ns_signal_data::ie_type, ns_signal_data::msg, ns_signal_data::nsvc, osmo_signal_dispatch(), pdu_type, ns_signal_data::pdu_type, S_NS_MISMATCH, and SS_L_NS.
Referenced by gprs_ns_rx_reset(), and gprs_ns_rx_reset_ack().
|
static |
References ns_signal_data::nsvc, ns_signal_data::old_nsvc, osmo_signal_dispatch(), S_NS_REPLACED, and SS_L_NS.
Referenced by gprs_ns_rx_reset(), and gprs_ns_rx_reset_ack().
|
inlinestatic |
References DNS, LOGL_DEBUG, LOGPSRC, NS_DESC_A, NS_DESC_B, NS_DESC_R, gprs_nsvc::nsei, gprs_nsvc::nsvci, gprs_nsvc::remote_state, and gprs_nsvc::state.
|
static |
References handle_nsip_read(), handle_nsip_write(), OSMO_FD_READ, and OSMO_FD_WRITE.
Referenced by gprs_ns_nsip_listen().
References msgb::data, osmo_fd::fd, gprs_ns_inst::fd, gprs_nsvc::ip, msgb::len, msgb_free(), gprs_nsvc::nsi, and gprs_ns_inst::nsip.
Referenced by gprs_ns_cause_str(), and gprs_ns_tx().
|
static |
References gprs_nsvc::data_weight, and gprs_nsvc::sig_weight.
Referenced by gprs_ns_process_msg(), gprs_ns_tx(), and gprs_nsvc_start_test().
|
static |
References DEBUGP, DNS, get_value_string(), LOG_CTX_GB_NSVC, log_set_context(), gprs_nsvc::nsei, gprs_nsvc::nsi, osmo_gettimeofday(), osmo_timer_del(), osmo_timer_pending(), osmo_timer_schedule(), gprs_ns_inst::timeout, gprs_nsvc::timer, gprs_nsvc::timer_mode, timer_mode_tout, and gprs_nsvc::timer_started.
Referenced by gprs_ns_process_msg(), gprs_ns_timer_cb(), gprs_nsvc_reset(), and gprs_nsvc_start_test().
|
static |
References osmo_gettimeofday(), gprs_nsvc::timer_started, and timersub.
Referenced by gprs_ns_process_msg().
|
static |
References msgb::data, DNS, osmo_fd::fd, gprs_ns_msgb_alloc(), msgb::l2h, LOGL_ERROR, LOGP, msgb_free(), msgb_put(), NS_ALLOC_HEADROOM, NS_ALLOC_SIZE, and osmo_sock_get_name2().
Referenced by handle_nsip_read().
enum ns_pdu_type __attribute__ |
uint8_t gprs_ns_hdr::data[0] |
variable-length payload
Referenced by gprs_ns_process_msg(), gprs_ns_rx_block(), gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), gprs_ns_rx_sns(), gprs_ns_rx_status(), gprs_ns_rx_unitdata(), gprs_ns_sendmsg(), and gprs_ns_vc_create().
uint8_t data[0] |
variable-length payload
Referenced by bssgp_set_bssgp_callback(), fc_timer_cb(), gprs_ns_timer_cb(), gprs_nsvc_by_rem_addr(), gprs_sns_st_config_bss(), gprs_sns_st_config_sgsn(), gprs_sns_st_configured(), and gprs_sns_st_size().
uint8_t gprs_ns_ie_ip4_elem::data_weight |
uint8_t data_weight |
Referenced by gprs_nsvc_create2().
const struct value_string gprs_ns_pdu_strings[] |
Referenced by gprs_ns_rx_sns().
const struct value_string gprs_ns_pdu_strings[] |
Referenced by gprs_ns_rx_sns().
const struct value_string gprs_ns_signal_ns_names[] |
|
static |
Referenced by gprs_ns_instantiate().
uint32_t gprs_ns_ie_ip4_elem::ip_addr |
Referenced by gprs_nsvc_create_ip4(), gprs_sns_bss_fsm_alloc(), nsvc_by_ip4_elem(), update_remote_ip4_elem(), and vty_dump_sns_ip4().
uint32_t ip_addr |
Referenced by gprs_sns_st_configured().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
uint8_t gprs_ns_hdr::pdu_type |
NS PDU type.
Referenced by gprs_ns_process_msg(), gprs_ns_rx_sns(), gprs_ns_sendmsg(), gprs_ns_tx(), gprs_ns_tx_block(), gprs_ns_tx_block_ack(), gprs_ns_tx_reset(), gprs_ns_tx_reset_ack(), gprs_ns_tx_simple(), gprs_ns_tx_sns_ack(), gprs_ns_tx_sns_config(), gprs_ns_tx_sns_config_ack(), gprs_ns_tx_sns_size(), gprs_ns_tx_sns_size_ack(), gprs_ns_tx_status(), and gprs_ns_vc_create().
uint8_t pdu_type |
NS PDU type.
Referenced by bssgp_rcvmsg(), bssgp_rx_ptp(), bssgp_rx_sign(), bssgp_tx_simple_bvci(), and ns_osmo_signal_dispatch_mismatch().
uint8_t gprs_ns_ie_ip4_elem::sig_weight |
uint8_t sig_weight |
Referenced by gprs_nsvc_create2().
|
static |
|
static |
Referenced by gprs_ns_timer_cb(), and nsvc_start_timer().
uint16_t gprs_ns_ie_ip4_elem::udp_port |
Referenced by gprs_nsvc_create_ip4(), gprs_sns_bss_fsm_alloc(), nsvc_by_ip4_elem(), update_remote_ip4_elem(), and vty_dump_sns_ip4().
uint16_t udp_port |