Loading...
Searching...
No Matches
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.
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, gprs_ns_inst::fd, osmo_fd::fd, gprs_ns_inst::frgre, IPPROTO_GRE, gprs_ns_inst::local_ip, and nsfrgre_fd_cb().

## gprs_ns_frgre_sendmsg()

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

References gprs_nsvc::bts_addr, gprs_ns_inst::fd, osmo_fd::fd, gre_hdr::flags, gprs_ns_inst::frgre, gprs_nsvc::frgre, GRE_PTYPE_FR, IPPROTO_GRE, gprs_nsvc::nsi, and gre_hdr::ptype.

Referenced by gprs_ns_tx().

## handle_nsfrgre_read()

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

static

References osmo_fd::data, DNS, GPRS_NS_LL_FR_GRE, gprs_ns_rcvmsg(), and read_nsfrgre_msg().

Referenced by nsfrgre_fd_cb().

## handle_nsfrgre_write()

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

static

Referenced by nsfrgre_fd_cb().

## handle_rx_gre_ipv4()

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, gprs_ns_inst::fd, osmo_fd::fd, gprs_ns_inst::frgre, GRE_PTYPE_KAR, IPPROTO_GRE, and gre_hdr::ptype.

Referenced by read_nsfrgre_msg().

## nsfrgre_fd_cb()

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

static

References handle_nsfrgre_read(), and handle_nsfrgre_write().

Referenced by gprs_ns_frgre_listen().

## read_nsfrgre_msg()

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(), NS_ALLOC_SIZE, and gre_hdr::ptype.

Referenced by handle_nsfrgre_read().

## Variable Documentation

## flags

uint16_t flags

## ptype

uint16_t ptype