libosmogb 1.10.0.63-d25f
Osmocom Gb library
|
NS-over-FR-over-GRE implementation. More...
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <arpa/inet.h>
#include <osmocom/core/byteswap.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/select.h>
#include <osmocom/core/socket.h>
#include <osmocom/core/talloc.h>
#include <osmocom/gprs/gprs_ns2.h>
#include "gprs_ns2_internal.h"
Data Structures | |
struct | gre_hdr |
struct | priv_bind |
struct | priv_vc |
Macros | |
#define | GRE_PTYPE_FR 0x6559 |
#define | GRE_PTYPE_IPv4 0x0800 |
#define | GRE_PTYPE_IPv6 0x86dd |
#define | GRE_PTYPE_KAR 0x0000 /* keepalive response */ |
#define | IPPROTO_GRE 47 |
Functions | |
struct gre_hdr | __attribute__ ((packed)) |
static void | free_bind (struct gprs_ns2_vc_bind *bind) |
clean up all private driver state. More... | |
static int | frgre_sendmsg (struct gprs_ns2_vc_bind *bind, struct msgb *msg, struct osmo_sockaddr *dest) |
static void | free_vc (struct gprs_ns2_vc *nsvc) |
static struct priv_vc * | frgre_alloc_vc (struct gprs_ns2_vc_bind *bind, struct gprs_ns2_vc *nsvc, struct osmo_sockaddr *remote, uint16_t dlci) |
static int | handle_rx_gre_ipv6 (struct osmo_fd *bfd, struct msgb *msg, struct ip6_hdr *ip6hdr, struct gre_hdr *greh) |
static int | handle_rx_gre_ipv4 (struct osmo_fd *bfd, struct msgb *msg, struct iphdr *iph, struct gre_hdr *greh) |
static struct msgb * | read_nsfrgre_msg (struct osmo_fd *bfd, int *error, struct osmo_sockaddr *saddr, uint16_t *dlci, const struct gprs_ns2_vc_bind *bind) |
static int | ns2_find_vc_by_dlci (struct gprs_ns2_vc_bind *bind, uint16_t dlci, struct gprs_ns2_vc **result) |
static int | handle_nsfrgre_read (struct osmo_fd *bfd) |
static int | handle_nsfrgre_write (struct osmo_fd *bfd) |
static int | frgre_vc_sendmsg (struct gprs_ns2_vc *nsvc, struct msgb *msg) |
static int | frgre_fd_cb (struct osmo_fd *bfd, unsigned int what) |
int | gprs_ns2_is_frgre_bind (struct gprs_ns2_vc_bind *bind) |
determine if given bind is for FR-GRE encapsulation. More... | |
int | gprs_ns2_frgre_bind (struct gprs_ns2_inst *nsi, const char *name, const struct osmo_sockaddr *local, int dscp, struct gprs_ns2_vc_bind **result) |
Create a new bind for NS over FR-GRE. More... | |
Variables | |
uint16_t | flags |
uint16_t | ptype |
struct gprs_ns2_vc_driver | vc_driver_frgre |
struct priv_bind | __attribute__ |
NS-over-FR-over-GRE implementation.
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) as well as its successor 3GPP TS 48.016
#define GRE_PTYPE_FR 0x6559 |
#define GRE_PTYPE_IPv4 0x0800 |
#define GRE_PTYPE_IPv6 0x86dd |
#define GRE_PTYPE_KAR 0x0000 /* keepalive response */ |
#define IPPROTO_GRE 47 |
|
static |
clean up all private driver state.
Should be only called by gprs_ns2_free_bind()
References priv_bind::fd, llist_empty(), gprs_ns2_vc_bind::nsvc, OSMO_ASSERT, osmo_fd_close(), and gprs_ns2_vc_bind::priv.
|
static |
References OSMO_ASSERT, and gprs_ns2_vc::priv.
Referenced by gprs_ns2_frgre_bind().
|
static |
References priv_vc::dlci, gprs_ns2_vc::priv, and priv_vc::remote.
Referenced by handle_nsfrgre_read().
|
static |
References handle_nsfrgre_read(), handle_nsfrgre_write(), OSMO_FD_READ, and OSMO_FD_WRITE.
Referenced by gprs_ns2_frgre_bind().
|
inlinestatic |
References osmo_fd::fd, priv_bind::fd, msg, msgb_free(), gprs_ns2_vc_bind::priv, osmo_sockaddr::sa, and osmo_sockaddr::u.
Referenced by frgre_vc_sendmsg(), and handle_nsfrgre_read().
|
static |
References priv_bind::dlci, gre_hdr::flags, frgre_sendmsg(), GRE_PTYPE_FR, msg, msgb_length(), msgb_push(), NS_CTR_BYTES_OUT, NS_CTR_BYTES_OUT_DROP, NS_CTR_PKTS_OUT, NS_CTR_PKTS_OUT_DROP, gprs_ns2_vc_bind::nsvc, osmo_htons, OSMO_LIKELY, gprs_ns2_vc::priv, gprs_ns2_vc_bind::priv, gre_hdr::ptype, RATE_CTR_ADD_NS, RATE_CTR_INC_NS, and priv_vc::remote.
Referenced by gprs_ns2_frgre_bind().
int gprs_ns2_frgre_bind | ( | struct gprs_ns2_inst * | nsi, |
const char * | name, | ||
const struct osmo_sockaddr * | local, | ||
int | dscp, | ||
struct gprs_ns2_vc_bind ** | result | ||
) |
Create a new bind for NS over FR-GRE.
[in] | nsi | NS instance in which to create the bind |
[in] | local | local address on which to bind |
[in] | dscp | DSCP/TOS bits to use for transmitted data on this bind |
[out] | result | pointer to the created bind or if a bind with the name exists return the bind. |
References priv_bind::addr, osmo_fd::cb, osmo_fd::data, gprs_ns2_vc_bind::driver, priv_bind::dscp, priv_bind::fd, FRAME_RELAY_SDU, free_vc(), gprs_ns2_vc_bind::free_vc, frgre_fd_cb(), frgre_vc_sendmsg(), gprs_ns2_bind_by_name(), gprs_ns2_free_bind(), GPRS_NS2_LL_FR_GRE, INIT_LLIST_HEAD, IPPROTO_GRE, gprs_ns2_vc_bind::ll, gprs_ns2_vc_bind::mtu, name, ns2_bind_alloc(), gprs_ns2_vc_bind::nsi, gprs_ns2_vc_bind::nsvc, OSMO_SOCK_F_BIND, OSMO_SOCK_F_DSCP, osmo_sock_init_osa_ofd(), gprs_ns2_vc_bind::priv, osmo_sockaddr::sa, gprs_ns2_vc_bind::send_vc, gprs_ns2_vc_bind::transfer_capability, osmo_sockaddr::u, and vc_driver_frgre.
int gprs_ns2_is_frgre_bind | ( | struct gprs_ns2_vc_bind * | bind | ) |
determine if given bind is for FR-GRE encapsulation.
References gprs_ns2_vc_bind::driver, and vc_driver_frgre.
|
static |
References osmo_fd::data, frgre_alloc_vc(), frgre_sendmsg(), LOGBIND, LOGL_INFO, msg, msgb_free(), ns2_create_vc(), NS2_CS_CREATED, NS2_CS_ERROR, NS2_CS_FOUND, NS2_CS_REJECTED, NS2_CS_SKIPPED, ns2_find_vc_by_dlci(), ns2_recv_vc(), ns2_vc_fsm_start(), and read_nsfrgre_msg().
Referenced by frgre_fd_cb().
|
static |
Referenced by frgre_fd_cb().
|
static |
References osmo_fd::data, osmo_fd::fd, priv_bind::fd, GRE_PTYPE_KAR, IPPROTO_GRE, LOGBIND, LOGL_DEBUG, LOGL_ERROR, msg, osmo_htons, gprs_ns2_vc_bind::priv, and gre_hdr::ptype.
Referenced by read_nsfrgre_msg().
|
static |
References osmo_fd::data, osmo_fd::fd, priv_bind::fd, GRE_PTYPE_KAR, IPPROTO_GRE, LOGBIND, LOGL_DEBUG, LOGL_ERROR, msg, osmo_htons, gprs_ns2_vc_bind::priv, and gre_hdr::ptype.
Referenced by read_nsfrgre_msg().
|
static |
References priv_vc::dlci, llist_for_each_entry, gprs_ns2_vc_bind::nsvc, and gprs_ns2_vc::priv.
Referenced by handle_nsfrgre_read().
|
static |
References osmo_fd::fd, gre_hdr::flags, GRE_PTYPE_FR, GRE_PTYPE_IPv4, GRE_PTYPE_IPv6, handle_rx_gre_ipv4(), handle_rx_gre_ipv6(), if(), LOGBIND, LOGL_ERROR, LOGL_NOTICE, msg, msgb_alloc(), msgb_free(), msgb_put(), NS_ALLOC_SIZE, osmo_ntohs, gre_hdr::ptype, osmo_sockaddr::sa, and osmo_sockaddr::u.
Referenced by handle_nsfrgre_read().
struct priv_bind __attribute__ |
uint16_t flags |
uint16_t ptype |
struct gprs_ns2_vc_driver vc_driver_frgre |
Referenced by gprs_ns2_frgre_bind(), and gprs_ns2_is_frgre_bind().