libosmogb 1.13.1.1-afb4 Osmocom Gb library

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
gprs_ns.h File Reference
Libgb
`#include <stdint.h>`
`#include <netinet/in.h>`
`#include <osmocom/core/linuxlist.h>`
`#include <osmocom/core/msgb.h>`
`#include <osmocom/core/timer.h>`
`#include <osmocom/core/select.h>`
`#include <osmocom/gprs/gprs_msgb.h>`
`#include <osmocom/gprs/protocol/gsm_08_16.h>`

Go to the source code of this file.

## Data Structures
struct | gprs_ns_inst
| An instance of the NS protocol stack. More...
struct | gprs_nsvc
| Structure representing a single NS-VC. More...
struct | ns_signal_data

## Macros
#define | NS_TIMERS_COUNT 8
#define | NS_TIMERS "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries|tsns-prov)"
#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")

## Typedefs
typedef int | gprs_ns_cb_t(enum gprs_ns_evt event, struct gprs_nsvc *nsvc, struct msgb *msg, uint16_t bvci)
| Osmocom GPRS callback function type. More...

## Enumerations
enum | ns_timeout { NS_TOUT_TNS_BLOCK , NS_TOUT_TNS_BLOCK_RETRIES , NS_TOUT_TNS_RESET , NS_TOUT_TNS_RESET_RETRIES , NS_TOUT_TNS_TEST , NS_TOUT_TNS_ALIVE , NS_TOUT_TNS_ALIVE_RETRIES , NS_TOUT_TSNS_PROV }
enum | gprs_ns_ll { GPRS_NS_LL_UDP , GPRS_NS_LL_E1 , GPRS_NS_LL_FR_GRE }
| Osmocom NS link layer types. More...
enum | gprs_ns_evt { GPRS_NS_EVT_UNIT_DATA }
| Osmoco NS events. More...
enum | gprs_ns_cs { GPRS_NS_CS_CREATED , GPRS_NS_CS_FOUND , GPRS_NS_CS_REJECTED , GPRS_NS_CS_SKIPPED , GPRS_NS_CS_ERROR }
| Osmocom NS VC create status. More...
enum | nsvc_timer_mode { NSVC_TIMER_TNS_TEST , NSVC_TIMER_TNS_ALIVE , NSVC_TIMER_TNS_RESET , _NSVC_TIMER_NR , NSVC_TIMER_TNS_TEST , NSVC_TIMER_TNS_ALIVE , NSVC_TIMER_TNS_RESET , _NSVC_TIMER_NR }
enum | signal_ns { S_NS_RESET , S_NS_BLOCK , S_NS_UNBLOCK , S_NS_ALIVE_EXP , S_NS_REPLACED , S_NS_MISMATCH , S_SNS_CONFIGURED }

## Functions
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...
int | gprs_ns_nsip_listen (struct gprs_ns_inst *nsi)
| Create a listening socket for GPRS NS/UDP/IP. 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...
int | gprs_ns_sendmsg (struct gprs_ns_inst *nsi, struct msgb *msg)
| High-level function for transmitting a NS-UNITDATA messsage. 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...
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...
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_block (struct gprs_nsvc *nsvc, uint8_t cause)
| Transmit a NS-BLOCK 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_frgre_listen (struct gprs_ns_inst *nsi)
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...
struct gprs_nsvc * | gprs_nsvc_by_nsei (struct gprs_ns_inst *nsi, uint16_t nsei)
| Lookup struct gprs_nsvc based on NSEI. More...
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_rem_addr (struct gprs_ns_inst *nsi, const struct sockaddr_in *sin)
| Lookup NS-VC based on specified remote peer socket addr. More...
int | gprs_nsvc_reset (struct gprs_nsvc *nsvc, uint8_t cause)
| Initiate a RESET procedure. More...
int | gprs_ns_vty_init (struct gprs_ns_inst *nsi)
const char * | gprs_ns_ll_str (const struct gprs_nsvc *nsvc)
char * | gprs_ns_ll_str_buf (char *buf, size_t buf_len, 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 msgb * | gprs_ns_msgb_alloc (void)
const char * | gprs_ns_cause_str (enum ns_cause cause)
| Obtain a human-readable string for NS cause value. 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...

## Variables
const struct value_string | gprs_ns_signal_ns_names []

## Macro Definition Documentation

## ◆ NS_ALLOC_HEADROOM

#define NS_ALLOC_HEADROOM 20

## ◆ NS_ALLOC_SIZE

#define NS_ALLOC_SIZE 3072

## ◆ NS_DESC_A

#define NS_DESC_A | ( |  | st | ) | ((st) & NSE_S_ALIVE ? "ALIVE" : "DEAD")

## ◆ NS_DESC_B

#define NS_DESC_B | ( |  | st | ) | ((st) & NSE_S_BLOCKED ? "BLOCKED" : "UNBLOCKED")

## ◆ NS_DESC_R

#define NS_DESC_R | ( |  | st | ) | ((st) & NSE_S_RESET ? "RESET" : "UNRESET")

## ◆ NS_TIMERS

#define NS_TIMERS "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries|tsns-prov)"

## ◆ NS_TIMERS_COUNT

#define NS_TIMERS_COUNT 8

## ◆ NS_TIMERS_HELP

#define NS_TIMERS_HELP

Value:
"(un)blocking Timer (Tns-block) timeout\n" \
"(un)blocking Timer (Tns-block) number of retries\n" \
"Reset Timer (Tns-reset) timeout\n" \
"Reset Timer (Tns-reset) number of retries\n" \
"Test Timer (Tns-test) timeout\n" \
"Alive Timer (Tns-alive) timeout\n" \
"Alive Timer (Tns-alive) number of retries\n" \
"SNS Provision Timer (Tsns-prov) timeout\n"

## ◆ NSE_S_ALIVE

#define NSE_S_ALIVE 0x0002

## ◆ NSE_S_BLOCKED

#define NSE_S_BLOCKED 0x0001

## ◆ NSE_S_RESET

#define NSE_S_RESET 0x0004

## Typedef Documentation

## ◆ gprs_ns_cb_t

typedef int gprs_ns_cb_t(enum gprs_ns_evt event, struct gprs_nsvc *nsvc, struct msgb *msg, uint16_t bvci)

Osmocom GPRS callback function type.

## Enumeration Type Documentation

## ◆ gprs_ns_cs

enum gprs_ns_cs

Osmocom NS VC create status.

Enumerator
GPRS_NS_CS_CREATED | A NSVC object has been created.
GPRS_NS_CS_FOUND | A NSVC object has been found.
GPRS_NS_CS_REJECTED | Rejected and answered message.
GPRS_NS_CS_SKIPPED | Skipped message.
GPRS_NS_CS_ERROR | Failed to process message.

## ◆ gprs_ns_evt

enum gprs_ns_evt

Osmoco NS events.

Enumerator
GPRS_NS_EVT_UNIT_DATA |

## ◆ gprs_ns_ll

enum gprs_ns_ll

Osmocom NS link layer types.

Enumerator
GPRS_NS_LL_UDP | NS/UDP/IP.
GPRS_NS_LL_E1 | NS/E1.
GPRS_NS_LL_FR_GRE | NS/FR/GRE/IP.

## ◆ ns_timeout

enum ns_timeout

Enumerator
NS_TOUT_TNS_BLOCK |
NS_TOUT_TNS_BLOCK_RETRIES |
NS_TOUT_TNS_RESET |
NS_TOUT_TNS_RESET_RETRIES |
NS_TOUT_TNS_TEST |
NS_TOUT_TNS_ALIVE |
NS_TOUT_TNS_ALIVE_RETRIES |
NS_TOUT_TSNS_PROV |

## ◆ nsvc_timer_mode

enum nsvc_timer_mode

Enumerator
NSVC_TIMER_TNS_TEST |
NSVC_TIMER_TNS_ALIVE |
NSVC_TIMER_TNS_RESET |
_NSVC_TIMER_NR |
NSVC_TIMER_TNS_TEST |
NSVC_TIMER_TNS_ALIVE |
NSVC_TIMER_TNS_RESET |
_NSVC_TIMER_NR |

## ◆ signal_ns

enum signal_ns

Enumerator
S_NS_RESET |
S_NS_BLOCK |
S_NS_UNBLOCK |
S_NS_ALIVE_EXP |
S_NS_REPLACED |
S_NS_MISMATCH |
S_SNS_CONFIGURED |

## Function Documentation

## ◆ gprs_ns_frgre_listen()

int gprs_ns_frgre_listen | ( | struct gprs_ns_inst * | nsi | ) |

References osmo_fd::cb, osmo_fd::data, DNS, gprs_ns_inst::enabled, osmo_fd::fd, gprs_ns_inst::fd, gprs_ns_inst::frgre, IPPROTO_GRE, gprs_ns_inst::local_ip, LOGL_ERROR, LOGP, nsfrgre_fd_cb(), osmo_htonl, OSMO_SOCK_F_BIND, and osmo_sock_init_ofd().

## ◆ gprs_ns_vty_init()

int gprs_ns_vty_init | ( | struct gprs_ns_inst * | nsi | ) |

References CFG_LOG_NODE, CONFIG_NODE, config_write_ns(), ENABLE_NODE, install_lib_element(), install_lib_element_ve(), install_node(), L_NS_NODE, ns_node, gprs_nsvc::nsi, and vty_nsi.