libosmogb 1.13.1.1-afb4 Osmocom Gb library

Data Structures | Macros | Functions | Variables
gprs_ns_frgre.c File Reference

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 <arpa/inet.h>`
`#include <osmocom/core/select.h>`
`#include <osmocom/core/byteswap.h>`
`#include <osmocom/core/msgb.h>`
`#include <osmocom/core/talloc.h>`
`#include <osmocom/core/socket.h>`
`#include <osmocom/gprs/gprs_ns.h>`
`#include "common_vty.h"`

## Data Structures
struct | gre_hdr

## Macros
#define | GRE_PTYPE_FR 0x6559
#define | GRE_PTYPE_IPv4 0x0800
#define | GRE_PTYPE_KAR 0x0000 /* keepalive response */
#define | IPPROTO_GRE 47

## Functions
struct gre_hdr | __attribute__ ((packed))
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 sockaddr_in *saddr)
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...
static int | handle_nsfrgre_read (struct osmo_fd *bfd)
static int | handle_nsfrgre_write (struct osmo_fd *bfd)
int | gprs_ns_frgre_sendmsg (struct gprs_nsvc *nsvc, struct msgb *msg)
static int | nsfrgre_fd_cb (struct osmo_fd *bfd, unsigned int what)
int | gprs_ns_frgre_listen (struct gprs_ns_inst *nsi)

## Variables
uint16_t | flags
uint16_t | ptype

## Detailed Description

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).

## Macro Definition Documentation

## ◆ GRE_PTYPE_FR

#define GRE_PTYPE_FR 0x6559

## ◆ GRE_PTYPE_IPv4

#define GRE_PTYPE_IPv4 0x0800

## ◆ GRE_PTYPE_KAR

#define GRE_PTYPE_KAR 0x0000 /* keepalive response */

## ◆ IPPROTO_GRE

#define IPPROTO_GRE 47

## 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_frgre_sendmsg()

int gprs_ns_frgre_sendmsg | ( | struct gprs_nsvc * | nsvc,
|  | struct msgb * | msg
| ) |  |

References gprs_nsvc::bts_addr, osmo_fd::fd, gprs_ns_inst::fd, gre_hdr::flags, gprs_ns_inst::frgre, gprs_nsvc::frgre, GRE_PTYPE_FR, IPPROTO_GRE, msg, msgb_free(), msgb_push(), gprs_nsvc::nsi, osmo_htons, osmo_ntohs, and gre_hdr::ptype.

Referenced by gprs_ns_tx().

## ◆ handle_nsfrgre_read()

static int handle_nsfrgre_read | ( | struct osmo_fd * | bfd | ) |
| static

References osmo_fd::data, DNS, GPRS_NS_LL_FR_GRE, gprs_ns_rcvmsg(), LOGL_INFO, LOGP, msg, msgb_free(), osmo_ntohs, and read_nsfrgre_msg().

Referenced by nsfrgre_fd_cb().

## ◆ handle_nsfrgre_write()

static int handle_nsfrgre_write | ( | struct osmo_fd * | bfd | ) |
| static

Referenced by nsfrgre_fd_cb().

## ◆ handle_rx_gre_ipv4()

static int handle_rx_gre_ipv4 | ( | struct osmo_fd * | bfd,
|  | struct msgb * | msg,
|  | struct iphdr * | iph,
|  | struct gre_hdr * | greh
| ) |  |
| static

References osmo_fd::data, DNS, osmo_fd::fd, gprs_ns_inst::fd, gprs_ns_inst::frgre, GRE_PTYPE_KAR, IPPROTO_GRE, LOGL_DEBUG, LOGL_ERROR, LOGP, msg, osmo_htons, and gre_hdr::ptype.

Referenced by read_nsfrgre_msg().

## ◆ nsfrgre_fd_cb()

static int nsfrgre_fd_cb | ( | struct osmo_fd * | bfd,
|  | unsigned int | what
| ) |  |
| static

References handle_nsfrgre_read(), handle_nsfrgre_write(), OSMO_FD_READ, and OSMO_FD_WRITE.

Referenced by gprs_ns_frgre_listen().

## ◆ read_nsfrgre_msg()

static struct msgb * read_nsfrgre_msg | ( | struct osmo_fd * | bfd,
|  | int * | error,
|  | struct sockaddr_in * | saddr
| ) |  |
| static

References DNS, osmo_fd::fd, gre_hdr::flags, GRE_PTYPE_FR, GRE_PTYPE_IPv4, handle_rx_gre_ipv4(), if(), LOGL_ERROR, LOGL_NOTICE, LOGP, msg, msgb_alloc(), msgb_free(), msgb_put(), NS_ALLOC_SIZE, osmo_htons, osmo_ntohs, and gre_hdr::ptype.

Referenced by handle_nsfrgre_read().

## Variable Documentation

## ◆ flags

uint16_t flags

## ◆ ptype

uint16_t ptype