|
libosmogb
1.5.1
Osmocom Gb library
|
#include <stdbool.h>#include <stdint.h>#include <osmocom/gprs/protocol/gsm_08_16.h>#include <osmocom/gprs/gprs_ns2.h>Go to the source code of this file.
Data Structures | |
| struct | gprs_ns2_inst |
| An instance of the NS protocol stack. More... | |
| struct | gprs_ns2_nse |
| Structure repesenting a NSE. More... | |
| struct | gprs_ns2_vc |
| Structure representing a single NS-VC. More... | |
| struct | gprs_ns2_vc_bind |
| Structure repesenting a bind instance. More... | |
| struct | gprs_ns2_vc_driver |
Macros | |
| #define | LOGNSE(nse, lvl, fmt, args ...) LOGP(DLNS, lvl, "NSE(%05u) " fmt, (nse)->nsei, ## args) |
| #define | LOGBIND(bind, lvl, fmt, args ...) LOGP(DLNS, lvl, "BIND(%s) " fmt, (bind)->name, ## args) |
| #define | LOGNSVC(nsvc, lvl, fmt, args ...) |
| #define | NS_TIMERS_COUNT 10 |
| #define | NS_TIMERS "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries|tsns-prov|tsns-size-retries|tsns-config-retries)" |
| #define | NS_TIMERS_HELP |
| #define | NS_ALLOC_SIZE 3072 |
| #define | NS_ALLOC_HEADROOM 20 |
| #define | NSE_S_BLOCKED 0x0001 |
| #define | NSE_S_ALIVE 0x0002 |
| #define | NSE_S_RESET 0x0004 |
| #define | NS_DESC_B(st) ((st) & NSE_S_BLOCKED ? "BLOCKED" : "UNBLOCKED") |
| #define | NS_DESC_A(st) ((st) & NSE_S_ALIVE ? "ALIVE" : "DEAD") |
| #define | NS_DESC_R(st) ((st) & NSE_S_RESET ? "RESET" : "UNRESET") |
Functions | |
| enum ns2_cs | ns2_create_vc (struct gprs_ns2_vc_bind *bind, struct msgb *msg, const char *logname, struct msgb **reject, struct gprs_ns2_vc **success) |
| Create a new NS-VC based on a [received] message. More... | |
| int | ns2_recv_vc (struct gprs_ns2_vc *nsvc, struct msgb *msg) |
| Bottom-side entry-point for received NS PDU from the driver/bind. More... | |
| struct gprs_ns2_vc * | ns2_vc_alloc (struct gprs_ns2_vc_bind *bind, struct gprs_ns2_nse *nse, bool initiater, enum gprs_ns2_vc_mode vc_mode, const char *id) |
| Allocate a NS-VC within the given bind + NSE. More... | |
| int | ns2_bind_alloc (struct gprs_ns2_inst *nsi, const char *name, struct gprs_ns2_vc_bind **result) |
| common allocation + low-level initialization of a bind. More... | |
| struct msgb * | ns2_msgb_alloc (void) |
| Allocate a message buffer for use with the NS2 stack. More... | |
| void | ns2_sns_write_vty (struct vty *vty, const struct gprs_ns2_nse *nse) |
| write IP-SNS to a vty More... | |
| void | ns2_sns_dump_vty (struct vty *vty, const char *prefix, const struct gprs_ns2_nse *nse, bool stats) |
| Dump the IP-SNS state to a vty. More... | |
| void | ns2_prim_status_ind (struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, uint16_t bvci, enum gprs_ns2_affecting_cause cause) |
| Send a STATUS.ind primitive to the specified NS instance user. More... | |
| void | ns2_nse_notify_alive (struct gprs_ns2_vc *nsvc, bool alive) |
| void | ns2_nse_update_mtu (struct gprs_ns2_nse *nse) |
| int | ns2_validate (struct gprs_ns2_vc *nsvc, uint8_t pdu_type, struct msgb *msg, struct tlv_parsed *tp, uint8_t *cause) |
| int | ns2_tx_sns_ack (struct gprs_ns2_vc *nsvc, uint8_t trans_id, uint8_t *cause, const struct gprs_ns_ie_ip4_elem *ip4_elems, unsigned int num_ip4_elems, const struct gprs_ns_ie_ip6_elem *ip6_elems, unsigned int num_ip6_elems) |
| Encode + Transmit a SNS-ACK as per Section 9.3.1. More... | |
| int | ns2_tx_sns_config (struct gprs_ns2_vc *nsvc, bool end_flag, const struct gprs_ns_ie_ip4_elem *ip4_elems, unsigned int num_ip4_elems, const struct gprs_ns_ie_ip6_elem *ip6_elems, unsigned int num_ip6_elems) |
| Encode + Transmit a SNS-CONFIG as per Section 9.3.4. More... | |
| int | ns2_tx_sns_config_ack (struct gprs_ns2_vc *nsvc, uint8_t *cause) |
| Encode + Transmit a SNS-CONFIG-ACK as per Section 9.3.5. More... | |
| int | ns2_tx_sns_size (struct gprs_ns2_vc *nsvc, bool reset_flag, uint16_t max_nr_nsvc, int ip4_ep_nr, int ip6_ep_nr) |
| Encode + transmit a SNS-SIZE as per Section 9.3.7. More... | |
| int | ns2_tx_sns_size_ack (struct gprs_ns2_vc *nsvc, uint8_t *cause) |
| Encode + Transmit a SNS-SIZE-ACK as per Section 9.3.8. More... | |
| int | ns2_tx_block (struct gprs_ns2_vc *nsvc, uint8_t cause) |
| Transmit a NS-BLOCK on a given NS-VC. More... | |
| int | ns2_tx_block_ack (struct gprs_ns2_vc *nsvc) |
| Transmit a NS-BLOCK-ACK on a given NS-VC. More... | |
| int | ns2_tx_reset (struct gprs_ns2_vc *nsvc, uint8_t cause) |
| Transmit a NS-RESET on a given NS-VC. More... | |
| int | ns2_tx_reset_ack (struct gprs_ns2_vc *nsvc) |
| Transmit a NS-RESET-ACK on a given NS-VC. More... | |
| int | ns2_tx_unblock (struct gprs_ns2_vc *nsvc) |
| Transmit a NS-UNBLOCK on a given NS-VC. More... | |
| int | ns2_tx_unblock_ack (struct gprs_ns2_vc *nsvc) |
| Transmit a NS-UNBLOCK-ACK on a given NS-VC. More... | |
| int | ns2_tx_alive (struct gprs_ns2_vc *nsvc) |
| Transmit a NS-ALIVE on a given NS-VC. More... | |
| int | ns2_tx_alive_ack (struct gprs_ns2_vc *nsvc) |
| Transmit a NS-ALIVE-ACK on a given NS-VC. More... | |
| int | ns2_tx_unit_data (struct gprs_ns2_vc *nsvc, uint16_t bvci, uint8_t sducontrol, struct msgb *msg) |
| Transmit NS-UNITDATA on a given NS-VC. More... | |
| int | ns2_tx_status (struct gprs_ns2_vc *nsvc, uint8_t cause, uint16_t bvci, struct msgb *orig_msg) |
| Transmit a NS-STATUS on a given NS-VC. More... | |
| struct gprs_ns2_vc * | ns2_ip_bind_connect (struct gprs_ns2_vc_bind *bind, struct gprs_ns2_nse *nse, const struct osmo_sockaddr *remote) |
| Create new NS-VC to a given remote address. More... | |
| int | ns2_ip_count_bind (struct gprs_ns2_inst *nsi, struct osmo_sockaddr *remote) |
| Count UDP binds compatible with remote. More... | |
| struct gprs_ns2_vc_bind * | ns2_ip_get_bind_by_index (struct gprs_ns2_inst *nsi, struct osmo_sockaddr *remote, int index) |
| int | ns2_sns_rx (struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp) |
| main entry point for receiving SNS messages from the network. More... | |
| struct osmo_fsm_inst * | ns2_sns_bss_fsm_alloc (struct gprs_ns2_nse *nse, const char *id) |
| Allocate an IP-SNS FSM for the BSS side. More... | |
| void | ns2_sns_replace_nsvc (struct gprs_ns2_vc *nsvc) |
| called when a nsvc is beeing freed or the nsvc became dead More... | |
| void | ns2_sns_notify_alive (struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, bool alive) |
| void | ns2_sns_update_weights (struct gprs_ns2_vc_bind *bind) |
| struct osmo_fsm_inst * | ns2_vc_fsm_alloc (struct gprs_ns2_vc *nsvc, const char *id, bool initiate) |
| gprs_ns2_vc_fsm_alloc More... | |
| int | ns2_vc_fsm_start (struct gprs_ns2_vc *nsvc) |
| Start a NS-VC FSM. More... | |
| int | ns2_vc_force_unconfigured (struct gprs_ns2_vc *nsvc) |
| Reset a NS-VC FSM. More... | |
| int | ns2_vc_rx (struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp) |
| entry point for messages from the driver/VL More... | |
| int | ns2_vc_is_alive (struct gprs_ns2_vc *nsvc) |
| int | ns2_vc_is_unblocked (struct gprs_ns2_vc *nsvc) |
| is the given NS-VC unblocked? More... | |
| int | ns2_vc_block (struct gprs_ns2_vc *nsvc) |
| Block a NS-VC. More... | |
| int | ns2_vc_unblock (struct gprs_ns2_vc *nsvc) |
| Unblock a NS-VC. More... | |
| void | ns2_nse_notify_unblocked (struct gprs_ns2_vc *nsvc, bool unblocked) |
| Notify a nse about the change of a NS-VC. More... | |
| enum gprs_ns2_vc_mode | ns2_dialect_to_vc_mode (enum gprs_ns2_dialect dialect) |
| int | ns2_count_transfer_cap (struct gprs_ns2_nse *nse, uint16_t bvci) |
| calculate the transfer capabilities for a nse More... | |
Referenced by gprs_ns2_create_nse(), gprs_ns2_sns_del_endpoint(), ns2_create_vc(), ns2_ip_bind_connect(), and ns2_prim_status_ind().
| #define LOGNSVC | ( | nsvc, | |
| lvl, | |||
| fmt, | |||
| args ... | |||
| ) |
Referenced by ns2_create_vc(), ns2_prim_status_ind(), ns2_sns_rx(), ns2_tx_alive(), ns2_tx_alive_ack(), ns2_tx_block(), ns2_tx_block_ack(), ns2_tx_reset(), ns2_tx_reset_ack(), ns2_tx_sns_ack(), ns2_tx_sns_config(), ns2_tx_sns_config_ack(), ns2_tx_sns_size(), ns2_tx_sns_size_ack(), ns2_tx_status(), ns2_tx_unblock(), ns2_tx_unblock_ack(), ns2_tx_unit_data(), and ns2_vc_rx().
| #define NS_ALLOC_HEADROOM 20 |
| #define NS_ALLOC_SIZE 3072 |
| #define NS_DESC_A | ( | st | ) | ((st) & NSE_S_ALIVE ? "ALIVE" : "DEAD") |
| #define NS_DESC_B | ( | st | ) | ((st) & NSE_S_BLOCKED ? "BLOCKED" : "UNBLOCKED") |
| #define NS_DESC_R | ( | st | ) | ((st) & NSE_S_RESET ? "RESET" : "UNRESET") |
| #define NS_TIMERS "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries|tsns-prov|tsns-size-retries|tsns-config-retries)" |
| #define NS_TIMERS_COUNT 10 |
| #define NS_TIMERS_HELP |
| #define NSE_S_ALIVE 0x0002 |
| #define NSE_S_BLOCKED 0x0001 |
| #define NSE_S_RESET 0x0004 |
| enum ns2_bind_stat |
| enum ns2_cs |
| enum ns2_timeout |
| enum ns2_vc_stat |
| enum ns_ctr |
| enum nsvc_timer_mode |
| struct gprs_ns2_vc* ns2_ip_bind_connect | ( | struct gprs_ns2_vc_bind * | bind, |
| struct gprs_ns2_nse * | nse, | ||
| const struct osmo_sockaddr * | remote | ||
| ) |
Create new NS-VC to a given remote address.
| [in] | bind | the bind we want to connect |
| [in] | nse | NS entity to be used for the new NS-VC |
| [in] | remote | remote address to connect to |
References gprs_ns2_nse::dialect, gprs_ns2_free_nsvc(), gprs_ns2_is_ip_bind(), gprs_ns2_lltype_str(), gprs_ns2_nsvc_by_sockaddr_bind(), gprs_ns2_nse::ll, LOGL_ERROR, LOGNSE, ns2_dialect_to_vc_mode(), ns2_vc_alloc(), gprs_ns2_nse::nsei, OSMO_ASSERT, osmo_identifier_sanitize_buf(), osmo_sockaddr_to_str(), gprs_ns2_vc::priv, and priv_vc::remote.
Referenced by gprs_ns2_ip_connect_inactive(), and ns2_sns_st_size_onenter().
| int ns2_ip_count_bind | ( | struct gprs_ns2_inst * | nsi, |
| struct osmo_sockaddr * | remote | ||
| ) |
Count UDP binds compatible with remote.
References gprs_ns2_inst::binding, gprs_ns2_ip_bind_sockaddr(), gprs_ns2_is_ip_bind(), priv_bind::list, llist_for_each_entry, osmo_sockaddr::sa, and osmo_sockaddr::u.
| struct gprs_ns2_vc_bind* ns2_ip_get_bind_by_index | ( | struct gprs_ns2_inst * | nsi, |
| struct osmo_sockaddr * | remote, | ||
| int | index | ||
| ) |
| void ns2_nse_notify_alive | ( | struct gprs_ns2_vc * | nsvc, |
| bool | alive | ||
| ) |
| struct osmo_fsm_inst* ns2_sns_bss_fsm_alloc | ( | struct gprs_ns2_nse * | nse, |
| const char * | id | ||
| ) |
Allocate an IP-SNS FSM for the BSS side.
| [in] | nse | NS Entity in which the FSM runs |
| [in] | id | string identifier |
References ns2_sns_state::binds, INIT_LLIST_HEAD, LOGL_DEBUG, ns2_sns_state::nse, osmo_fsm_inst_alloc(), osmo_fsm_inst_term, OSMO_FSM_TERM_ERROR, osmo_fsm_inst::priv, and ns2_sns_state::sns_endpoints.
Referenced by DEFUN(), and gprs_ns2_create_nse().
| void ns2_sns_dump_vty | ( | struct vty * | vty, |
| const char * | prefix, | ||
| const struct gprs_ns2_nse * | nse, | ||
| bool | stats | ||
| ) |
Dump the IP-SNS state to a vty.
| [in] | vty | VTY to which the state shall be printed |
| [in] | prefix | prefix to print at start of each line (typically indenting) |
| [in] | nse | NS Entity whose IP-SNS state shall be printed |
| [in] | stats | Whether or not statistics shall also be printed |
References gprs_ns2_nse::bss_sns_fi, ns2_sns_state::ip4_local, ns2_sns_state::ip4_remote, ns2_sns_state::ip6_local, ns2_sns_state::ip6_remote, ns2_sns_state::num_ip4_local, ns2_sns_state::num_ip4_remote, ns2_sns_state::num_ip6_local, ns2_sns_state::num_ip6_remote, ns2_sns_state::num_max_ip4_remote, ns2_sns_state::num_max_ip6_remote, ns2_sns_state::num_max_nsvcs, osmo_fsm_inst::priv, vty_dump_sns_ip4(), vty_dump_sns_ip6(), VTY_NEWLINE, vty_out(), and vty_out_fsm_inst2().
Referenced by dump_nse().
| void ns2_sns_notify_alive | ( | struct gprs_ns2_nse * | nse, |
| struct gprs_ns2_vc * | nsvc, | ||
| bool | alive | ||
| ) |
References ns2_sns_state::alive, gprs_ns2_nse::bss_sns_fi, GPRS_SNS_EV_REQ_NO_NSVC, GPRS_SNS_EV_REQ_NSVC_ALIVE, GPRS_SNS_ST_CONFIGURED, sns_endpoint::list, llist_for_each_entry, ns2_sns_replace_nsvc(), ns2_vc_is_unblocked(), gprs_ns2_nse::nsvc, osmo_fsm_inst_dispatch, osmo_fsm_inst::priv, ns2_sns_state::sns_nsvc, and osmo_fsm_inst::state.
Referenced by ns2_nse_notify_unblocked().
| void ns2_sns_replace_nsvc | ( | struct gprs_ns2_vc * | nsvc | ) |
called when a nsvc is beeing freed or the nsvc became dead
References ns2_sns_state::alive, gprs_ns2_nse::bss_sns_fi, GPRS_SNS_EV_REQ_NO_NSVC, if(), sns_endpoint::list, llist_for_each_entry, ns2_vc_is_unblocked(), gprs_ns2_vc::nse, gprs_ns2_nse::nsvc, osmo_fsm_inst_dispatch, osmo_fsm_inst::priv, and ns2_sns_state::sns_nsvc.
Referenced by gprs_ns2_free_nsvc(), and ns2_sns_notify_alive().
| int ns2_sns_rx | ( | struct gprs_ns2_vc * | nsvc, |
| struct msgb * | msg, | ||
| struct tlv_parsed * | tp | ||
| ) |
main entry point for receiving SNS messages from the network.
| [in] | nsvc | NS-VC on which the message was received |
| [in] | msg | message buffer of the IP-SNS message |
| [in] | tp | parsed TLV structure of message |
References gprs_ns2_nse::bss_sns_fi, gprs_ns_hdr::data, get_value_string(), gprs_ns_pdu_strings, GPRS_SNS_EV_RX_ADD, GPRS_SNS_EV_RX_CHANGE_WEIGHT, GPRS_SNS_EV_RX_CONFIG, GPRS_SNS_EV_RX_CONFIG_ACK, GPRS_SNS_EV_RX_CONFIG_END, GPRS_SNS_EV_RX_DELETE, GPRS_SNS_EV_RX_SIZE, GPRS_SNS_EV_RX_SIZE_ACK, if(), msgb::l2h, LOGL_DEBUG, LOGL_ERROR, LOGL_NOTICE, LOGNSVC, LOGPFSML, gprs_ns2_vc::nse, gprs_ns2_nse::nsei, nsei, osmo_fsm_inst_dispatch, gprs_ns_hdr::pdu_type, 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.
| void ns2_sns_update_weights | ( | struct gprs_ns2_vc_bind * | bind | ) |
Referenced by gprs_ns2_ip_bind_set_sns_weight().
| void ns2_sns_write_vty | ( | struct vty * | vty, |
| const struct gprs_ns2_nse * | nse | ||
| ) |
write IP-SNS to a vty
| [in] | vty | VTY to which the state shall be printed |
| [in] | nse | NS Entity whose IP-SNS state shall be printed |
References gprs_ns2_nse::bss_sns_fi, osmo_sockaddr_str::ip, sns_endpoint::list, llist_for_each_entry, osmo_sockaddr_str_from_sockaddr(), osmo_sockaddr_str::port, osmo_fsm_inst::priv, sns_endpoint::saddr, osmo_sockaddr::sas, ns2_sns_state::sns_endpoints, osmo_sockaddr::u, VTY_NEWLINE, and vty_out().
Referenced by _config_write_ns_nse().
| int ns2_tx_alive | ( | struct gprs_ns2_vc * | nsvc | ) |
Transmit a NS-ALIVE on a given NS-VC.
| [in] | nsvc | NS-VC on which the NS-ALIVE is to be transmitted |
References LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_DEBUG, LOGNSVC, ns2_tx_simple(), NS_PDUT_ALIVE, and gprs_ns2_vc::nse.
Referenced by alive_timeout_handler(), ns2_st_alive_onenter(), and start_test_procedure().
| int ns2_tx_alive_ack | ( | struct gprs_ns2_vc * | 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 LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_DEBUG, LOGNSVC, ns2_tx_simple(), NS_PDUT_ALIVE_ACK, and gprs_ns2_vc::nse.
Referenced by ns2_vc_fsm_allstate_action().
| int ns2_tx_block | ( | struct gprs_ns2_vc * | nsvc, |
| uint8_t | cause | ||
| ) |
Transmit a NS-BLOCK on a given NS-VC.
| [in] | vc | NS-VC on which the NS-BLOCK is to be transmitted |
| [in] | cause | Numeric NS Cause value |
References rate_ctr_group::ctr, gprs_ns2_vc::ctrg, ERR_IF_NSVC_USES_SNS, gprs_ns2_cause_str(), msgb::l2h, LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGNSVC, msg, msgb_put(), msgb_tvlv_put(), ns2_msgb_alloc(), NS_CTR_BLOCKED, NS_IE_CAUSE, NS_IE_VCI, NS_PDUT_BLOCK, ns_vc_tx(), gprs_ns2_vc::nse, gprs_ns2_vc::nsvci, osmo_htons, gprs_ns_hdr::pdu_type, and rate_ctr_inc().
Referenced by ns2_st_blocked(), and ns2_st_blocked_onenter().
| int ns2_tx_block_ack | ( | struct gprs_ns2_vc * | nsvc | ) |
Transmit a NS-BLOCK-ACK on a given NS-VC.
| [in] | nsvc | NS-VC on which the NS-BLOCK is to be transmitted |
References ERR_IF_NSVC_USES_SNS, msgb::l2h, LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGNSVC, msg, msgb_put(), msgb_tvlv_put(), ns2_msgb_alloc(), NS_IE_VCI, NS_PDUT_BLOCK_ACK, ns_vc_tx(), gprs_ns2_vc::nse, gprs_ns2_vc::nsvci, osmo_htons, and gprs_ns_hdr::pdu_type.
Referenced by ns2_st_blocked(), and ns2_st_unblocked().
| int ns2_tx_reset | ( | struct gprs_ns2_vc * | nsvc, |
| uint8_t | cause | ||
| ) |
Transmit a NS-RESET on a given NS-VC.
| [in] | nsvc | NS-VC used for transmission [in] cause Numeric NS cause value |
References ERR_IF_NSVC_USES_SNS, gprs_ns2_cause_str(), msgb::l2h, LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGNSVC, msg, msgb_put(), msgb_tvlv_put(), ns2_msgb_alloc(), NS_IE_CAUSE, NS_IE_NSEI, NS_IE_VCI, NS_PDUT_RESET, ns_vc_tx(), gprs_ns2_vc::nse, gprs_ns2_nse::nsei, nsei, gprs_ns2_vc::nsvci, osmo_htons, and gprs_ns_hdr::pdu_type.
Referenced by ns2_st_reset_onenter().
| int ns2_tx_reset_ack | ( | struct gprs_ns2_vc * | nsvc | ) |
Transmit a NS-RESET-ACK on a given NS-VC.
| [in] | nsvc | NS-VC used for transmission |
References ERR_IF_NSVC_USES_SNS, msgb::l2h, LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGNSVC, msg, msgb_put(), msgb_tvlv_put(), ns2_msgb_alloc(), NS_IE_NSEI, NS_IE_VCI, NS_PDUT_RESET_ACK, ns_vc_tx(), gprs_ns2_vc::nse, gprs_ns2_nse::nsei, nsei, gprs_ns2_vc::nsvci, osmo_htons, and gprs_ns_hdr::pdu_type.
Referenced by ns2_st_reset(), and ns2_vc_rx().
| int ns2_tx_sns_ack | ( | struct gprs_ns2_vc * | nsvc, |
| uint8_t | trans_id, | ||
| uint8_t * | cause, | ||
| const struct gprs_ns_ie_ip4_elem * | ip4_elems, | ||
| unsigned int | num_ip4_elems, | ||
| const struct gprs_ns_ie_ip6_elem * | ip6_elems, | ||
| unsigned int | num_ip6_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_ns2_nse::bss_sns_fi, msgb::l2h, LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGNSVC, msg, msgb_free(), msgb_put(), msgb_tvlv_put(), msgb_v_put(), ns2_msgb_alloc(), NS_IE_CAUSE, NS_IE_IPv4_LIST, NS_IE_IPv6_LIST, NS_IE_NSEI, ns_vc_tx(), gprs_ns2_vc::nse, gprs_ns2_nse::nsei, nsei, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_ACK.
Referenced by ns2_sns_st_configured_add(), ns2_sns_st_configured_change(), and ns2_sns_st_configured_delete().
| int ns2_tx_sns_config | ( | struct gprs_ns2_vc * | nsvc, |
| bool | end_flag, | ||
| const struct gprs_ns_ie_ip4_elem * | ip4_elems, | ||
| unsigned int | num_ip4_elems, | ||
| const struct gprs_ns_ie_ip6_elem * | ip6_elems, | ||
| unsigned int | num_ip6_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_ns2_nse::bss_sns_fi, msgb::l2h, LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGNSVC, msg, msgb_free(), msgb_put(), msgb_tvlv_put(), msgb_v_put(), ns2_msgb_alloc(), NS_IE_IPv4_LIST, NS_IE_IPv6_LIST, NS_IE_NSEI, ns_vc_tx(), gprs_ns2_vc::nse, gprs_ns2_nse::nsei, nsei, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_CONFIG.
Referenced by ns2_sns_st_config_bss_onenter().
| int ns2_tx_sns_config_ack | ( | struct gprs_ns2_vc * | 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_ns2_nse::bss_sns_fi, msgb::l2h, LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGNSVC, msg, msgb_free(), msgb_put(), msgb_tvlv_put(), ns2_msgb_alloc(), NS_IE_CAUSE, NS_IE_NSEI, ns_vc_tx(), gprs_ns2_vc::nse, gprs_ns2_nse::nsei, nsei, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_CONFIG_ACK.
Referenced by ns_sns_st_config_sgsn_ip4(), and ns_sns_st_config_sgsn_ip6().
| int ns2_tx_sns_size | ( | struct gprs_ns2_vc * | nsvc, |
| bool | reset_flag, | ||
| uint16_t | max_nr_nsvc, | ||
| int | ip4_ep_nr, | ||
| int | 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 (< 0 will omit the TLV) |
| [in] | ip6_ep_nr | Number of IPv6 endpoints (< 0 will omit the TLV) |
References gprs_ns2_nse::bss_sns_fi, msgb::l2h, LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGNSVC, msg, msgb_free(), msgb_put(), msgb_tv16_put(), msgb_tv_put(), msgb_tvlv_put(), ns2_msgb_alloc(), NS_IE_IPv4_EP_NR, NS_IE_IPv6_EP_NR, NS_IE_MAX_NR_NSVC, NS_IE_NSEI, NS_IE_RESET_FLAG, ns_vc_tx(), gprs_ns2_vc::nse, gprs_ns2_nse::nsei, nsei, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_SIZE.
Referenced by ns2_sns_st_size_onenter().
| int ns2_tx_sns_size_ack | ( | struct gprs_ns2_vc * | 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_ns2_nse::bss_sns_fi, msgb::l2h, LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGNSVC, msg, msgb_free(), msgb_put(), msgb_tvlv_put(), ns2_msgb_alloc(), NS_IE_CAUSE, NS_IE_NSEI, ns_vc_tx(), gprs_ns2_vc::nse, gprs_ns2_nse::nsei, nsei, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_SIZE_ACK.
| int ns2_tx_status | ( | struct gprs_ns2_vc * | nsvc, |
| uint8_t | cause, | ||
| uint16_t | bvci, | ||
| struct msgb * | orig_msg | ||
| ) |
Transmit a NS-STATUS on a given NS-VC.
| [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 gprs_ns2_vc::bind, gprs_ns2_cause_str(), msgb::l2h, LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_NOTICE, LOGNSVC, msg, msgb_l2len(), msgb_length(), msgb_put(), msgb_tvlv_put(), gprs_ns2_vc_bind::mtu, ns2_msgb_alloc(), 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, ns_vc_tx(), gprs_ns2_vc::nse, gprs_ns2_vc::nsvci, osmo_htons, gprs_ns_hdr::pdu_type, and TVLV_GROSS_LEN().
Referenced by ns2_vc_fsm_allstate_action(), and ns2_vc_rx().
| int ns2_tx_unblock | ( | struct gprs_ns2_vc * | nsvc | ) |
Transmit a NS-UNBLOCK on a given NS-VC.
| [in] | nsvc | NS-VC on which the NS-UNBLOCK is to be transmitted |
References ERR_IF_NSVC_USES_SNS, LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGNSVC, ns2_tx_simple(), NS_PDUT_UNBLOCK, and gprs_ns2_vc::nse.
Referenced by ns2_st_blocked_onenter().
| int ns2_tx_unblock_ack | ( | struct gprs_ns2_vc * | nsvc | ) |
Transmit a NS-UNBLOCK-ACK on a given NS-VC.
| [in] | nsvc | NS-VC on which the NS-UNBLOCK-ACK is to be transmitted |
References ERR_IF_NSVC_USES_SNS, LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGNSVC, ns2_tx_simple(), NS_PDUT_UNBLOCK_ACK, and gprs_ns2_vc::nse.
Referenced by ns2_st_blocked(), and ns2_st_unblocked().
| int ns2_tx_unit_data | ( | struct gprs_ns2_vc * | nsvc, |
| uint16_t | bvci, | ||
| uint8_t | sducontrol, | ||
| struct msgb * | msg | ||
| ) |
Transmit NS-UNITDATA on a given NS-VC.
| [in] | nsvc | NS-VC on which the NS-UNITDATA is to be transmitted |
| [in] | bvci | BVCI to encode in NS-UNITDATA header |
| [in] | sducontrol | SDU control octet of NS header |
| [in] | msg | message buffer containing payload |
References gprs_ns_hdr::data, if(), msgb::l2h, LOG_CTX_GB_NSE, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGNSVC, msgb_free(), msgb_push(), NS_PDUT_UNITDATA, ns_vc_tx(), gprs_ns2_vc::nse, and gprs_ns_hdr::pdu_type.
Referenced by gprs_ns2_recv_prim().
| int ns2_validate | ( | struct gprs_ns2_vc * | nsvc, |
| uint8_t | pdu_type, | ||
| struct msgb * | msg, | ||
| struct tlv_parsed * | tp, | ||
| uint8_t * | cause | ||
| ) |
References msgb_l2len(), ns2_validate_block(), ns2_validate_block_ack(), ns2_validate_reset(), ns2_validate_reset_ack(), ns2_validate_status(), NS_CAUSE_PROTO_ERR_UNSPEC, 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, and NS_PDUT_UNBLOCK_ACK.
Referenced by ns2_vc_rx().
| int ns2_vc_block | ( | struct gprs_ns2_vc * | nsvc | ) |
Block a NS-VC.
| nsvc | the virtual circuit |
References gprs_ns2_vc::fi, GPRS_NS2_EV_REQ_OM_BLOCK, and osmo_fsm_inst_dispatch.
Referenced by DEFUN().
| int ns2_vc_force_unconfigured | ( | struct gprs_ns2_vc * | nsvc | ) |
Reset a NS-VC FSM.
| nsvc | the virtual circuit |
References gprs_ns2_vc::fi, GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED, and osmo_fsm_inst_dispatch.
Referenced by fr_dlci_status_cb(), and nsvc_force_unconf_cb().
| struct osmo_fsm_inst* ns2_vc_fsm_alloc | ( | struct gprs_ns2_vc * | nsvc, |
| const char * | id, | ||
| bool | initiator | ||
| ) |
gprs_ns2_vc_fsm_alloc
| ctx | |
| vc | |
| id | a char representation of the virtual curcuit |
| initiator | initiator is the site which starts the connection. Usually the BSS. |
References gprs_ns2_vc_priv::alive, alive_timeout_handler(), gprs_ns2_vc::fi, gprs_ns2_vc_priv::initiator, LOGL_DEBUG, gprs_ns2_vc_priv::nsvc, osmo_fsm_inst_alloc(), osmo_timer_setup(), osmo_fsm_inst::priv, and gprs_ns2_vc_priv::timer.
Referenced by ns2_vc_alloc().
| int ns2_vc_fsm_start | ( | struct gprs_ns2_vc * | nsvc | ) |
Start a NS-VC FSM.
| nsvc | the virtual circuit |
References gprs_ns2_vc::fi, GPRS_NS2_EV_REQ_START, GPRS_NS2_ST_UNCONFIGURED, osmo_fsm_inst_dispatch, and osmo_fsm_inst::state.
Referenced by fr_dlci_status_cb(), gprs_ns2_ip_connect(), gprs_ns2_start_alive_all_nsvcs(), handle_nsfrgre_read(), handle_nsip_read(), and nsvc_force_unconf_cb().
| int ns2_vc_is_alive | ( | struct gprs_ns2_vc * | nsvc | ) |
| int ns2_vc_is_unblocked | ( | struct gprs_ns2_vc * | nsvc | ) |
is the given NS-VC unblocked?
References gprs_ns2_vc::fi, GPRS_NS2_ST_UNBLOCKED, and osmo_fsm_inst::state.
Referenced by ns2_count_transfer_cap(), ns2_load_sharing_first(), ns2_load_sharing_modulo(), ns2_load_sharing_signal(), ns2_load_sharing_weight_modulo(), ns2_nse_data_sum(), ns2_sns_notify_alive(), and ns2_sns_replace_nsvc().
| int ns2_vc_rx | ( | struct gprs_ns2_vc * | nsvc, |
| struct msgb * | msg, | ||
| struct tlv_parsed * | tp | ||
| ) |
entry point for messages from the driver/VL
| nsvc | virtual circuit on which the message was received |
| msg | message that was received |
| tp | parsed TLVs of the received message |
References cause, gprs_ns2_vc::fi, get_value_string(), GPRS_NS2_EV_RX_ALIVE, GPRS_NS2_EV_RX_ALIVE_ACK, GPRS_NS2_EV_RX_BLOCK, GPRS_NS2_EV_RX_BLOCK_ACK, GPRS_NS2_EV_RX_RESET, GPRS_NS2_EV_RX_RESET_ACK, GPRS_NS2_EV_RX_UNBLOCK, GPRS_NS2_EV_RX_UNBLOCK_ACK, GPRS_NS2_EV_RX_UNITDATA, gprs_ns_pdu_strings, if(), msgb::l2h, LOGL_ERROR, LOGNSVC, LOGPFSML, msgb_free(), ns2_tx_reset_ack(), ns2_tx_status(), ns2_validate(), NS_IE_NSEI, NS_IE_VCI, 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, gprs_ns2_vc::nse, gprs_ns2_nse::nsei, nsei, gprs_ns2_vc::nsvci, gprs_ns2_vc::nsvci_is_valid, osmo_fsm_inst_dispatch, gprs_ns_hdr::pdu_type, TLVP_PRESENT, and tlvp_val16be().
| int ns2_vc_unblock | ( | struct gprs_ns2_vc * | nsvc | ) |
Unblock a NS-VC.
| nsvc | the virtual circuit |
References gprs_ns2_vc::fi, GPRS_NS2_EV_REQ_OM_UNBLOCK, and osmo_fsm_inst_dispatch.
Referenced by DEFUN().