aboutsummaryrefslogtreecommitdiffstats
path: root/gtp/pdp.h
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-11-02 13:06:18 +0100
committerHarald Welte <laforge@gnumonks.org>2011-11-02 13:06:18 +0100
commitbed35df298f4914fabedfc7c9387af3f2f9a9e9f (patch)
tree0079fe22d0839637d8c777d2eebb91cd35b065c2 /gtp/pdp.h
parentca36f293648ee19056df7ea9a1cbfcc93c800dc8 (diff)
Convert all code to Linux coding style
After so many years of silence, we don't expect the original author to return to the project. To make things a bit simpler for us, we convert the coding style to what we are used to (Linux style). The conversion was made using the 'Lindent' script which is part of the Linux kernel.
Diffstat (limited to 'gtp/pdp.h')
-rw-r--r--gtp/pdp.h274
1 files changed, 135 insertions, 139 deletions
diff --git a/gtp/pdp.h b/gtp/pdp.h
index e3bd06d..b069a6f 100644
--- a/gtp/pdp.h
+++ b/gtp/pdp.h
@@ -12,42 +12,40 @@
#ifndef _PDP_H
#define _PDP_H
-#define PDP_MAX 1024 /* Max number of PDP contexts */
-#define PDP_MAXNSAPI 16 /* Max number of NSAPI */
+#define PDP_MAX 1024 /* Max number of PDP contexts */
+#define PDP_MAXNSAPI 16 /* Max number of NSAPI */
-#define PDP_DEBUG 0 /* Print debug information */
+#define PDP_DEBUG 0 /* Print debug information */
/* GTP Information elements from 29.060 v3.9.0 7.7 Information Elements */
/* Also covers version 0. Note that version 0 6: QOS Profile was superceded *
* by 135: QOS Profile in version 1 */
-
struct sl_t {
-unsigned int l;
-char *v;
+ unsigned int l;
+ char *v;
};
struct ul_t {
-unsigned int l;
-unsigned char *v;
+ unsigned int l;
+ unsigned char *v;
};
struct ul16_t {
-unsigned int l;
-unsigned char v[16];
+ unsigned int l;
+ unsigned char v[16];
};
struct ul66_t {
-unsigned int l;
-unsigned char v[66];
+ unsigned int l;
+ unsigned char v[66];
};
struct ul255_t {
-unsigned int l;
-unsigned char v[255];
+ unsigned int l;
+ unsigned char v[255];
};
-
/* *****************************************************************
* Information storage for each PDP context
*
@@ -103,131 +101,130 @@ unsigned char v[255];
*****************************************************************/
struct pdp_t {
- /* Parameter determining if this PDP is in use. */
- uint8_t inuse; /* 0=free. 1=used by somebody */
-
- /* Pointers related to hash tables */
- struct pdp_t *tidnext;
- struct pdp_t *ipnext;
-
- /* Parameters shared by all PDP context belonging to the same MS */
-
- void *ipif; /* IP network interface */
- void *peer; /* Pointer to peer protocol */
- void *asap; /* Application specific service access point */
-
- uint64_t imsi; /* International Mobile Subscriber Identity.*/
- struct ul16_t msisdn; /* The basic MSISDN of the MS. */
- uint8_t mnrg; /* Indicates whether the MS is marked as not reachable for PS at the HLR. (1 bit, not transmitted) */
- uint8_t cch_sub; /* The charging characteristics for the MS, e.g. normal, prepaid, flat-rate, and/or hot billing subscription. (not transmitted) */
- uint16_t traceref; /* Identifies a record or a collection of records for a particular trace. */
- uint16_t tracetype;/* Indicates the type of trace. */
- struct ul_t triggerid;/* Identifies the entity that initiated the trace. */
- struct ul_t omcid; /* Identifies the OMC that shall receive the trace record(s). */
- uint8_t rec_hlr; /* Indicates if HLR or VLR is performing database recovery. (1 bit, not transmitted) */
-
- /* Parameters specific to each individual PDP context */
-
- uint8_t pdp_id; /* Index of the PDP context. (PDP context identifier) */
- uint8_t pdp_state;/* PDP State Packet data protocol state, INACTIVE or ACTIVE. (1 bit, not transmitted) */
- /* struct ul_t pdp_type; * PDP type; e.g. PPP or IP. */
- /* struct ul_t pdp_addr; * PDP address; e.g. an IP address. */
- struct ul66_t eua; /* End user address. PDP type and address combined */
- uint8_t pdp_dyn; /* Indicates whether PDP Address is static or dynamic. (1 bit, not transmitted) */
- struct ul255_t apn_req;/* The APN requested. */
- struct ul255_t apn_sub;/* The APN received from the HLR. */
- struct ul255_t apn_use;/* The APN Network Identifier currently used. */
- uint8_t nsapi; /* Network layer Service Access Point Identifier. (4 bit) */
- uint16_t ti; /* Transaction Identifier. (4 or 12 bit) */
-
- uint32_t teic_own; /* (Own Tunnel Endpoint Identifier Control) */
- uint32_t teid_own; /* (Own Tunnel Endpoint Identifier Data I) */
- uint32_t teic_gn; /* Tunnel Endpoint Identifier for the Gn and Gp interfaces. (Control plane) */
- uint32_t teid_gn; /* Tunnel Endpoint Identifier for the Gn and Gp interfaces. (Data I) */
- uint32_t tei_iu; /* Tunnel Endpoint Identifier for the Iu interface. */
-
- uint16_t fllc; /* (Local Flow Label Control, gtp0) */
- uint16_t fllu; /* (Local Flow Label Data I, gtp0) */
- uint16_t flrc; /* (Remote gn/gp Flow Label Control, gtp0) */
- uint16_t flru; /* (Remote gn/gp Flow Label Data I, gtp0) */
-
- struct ul255_t tft; /* Traffic flow template. */
- /*struct ul16_t sgsnc; * The IP address of the SGSN currently serving this MS. (Control plane) */
- /*struct ul16_t sgsnu; * The IP address of the SGSN currently serving this MS. (User plane) */
- /*struct ul16_t ggsnc; * The IP address of the GGSN currently used. (Control plane) */
- /*struct ul16_t ggsnu; * The IP address of the GGSN currently used. (User plane) */
-
- struct ul16_t gsnlc; /* The IP address of the local GSN. (Control plane) */
- struct ul16_t gsnlu; /* The IP address of the local GSN. (User plane) */
- struct ul16_t gsnrc; /* The IP address of the remote GSN. (Control plane) */
- struct ul16_t gsnru; /* The IP address of the remote GSN. (User plane) */
-
- uint8_t vplmn_allow; /* Specifies whether the MS is allowed to use the APN in the domain of the HPLMN only, or additionally the APN in the domain of the VPLMN. (1 bit) */
- uint8_t qos_sub0[3]; /* The quality of service profile subscribed. */
- uint8_t qos_req0[3]; /* The quality of service profile requested. */
- uint8_t qos_neg0[3]; /* The quality of service profile negotiated. */
- struct ul255_t qos_sub; /* The quality of service profile subscribed. */
- struct ul255_t qos_req; /* The quality of service profile requested. */
- struct ul255_t qos_neg; /* The quality of service profile negotiated. */
- uint8_t radio_pri;/* The RLC/MAC radio priority level for uplink user data transmission. (4 bit) */
- uint16_t flow_id; /* Packet flow identifier. */
- /* struct ul_t bssqos_neg; * The aggregate BSS quality of service profile negotiated for the packet flow that this PDP context belongs to. (NOT GTP)*/
- uint8_t sndcpd; /* SNDCP sequence number of the next downlink N-PDU to be sent to the MS. */
- uint8_t sndcpu; /* SNDCP sequence number of the next uplink N-PDU expected from the MS. */
- uint8_t rec_sgsn; /* Indicates if the SGSN is performing database recovery. (1 bit, not transmitted) */
+ /* Parameter determining if this PDP is in use. */
+ uint8_t inuse; /* 0=free. 1=used by somebody */
+
+ /* Pointers related to hash tables */
+ struct pdp_t *tidnext;
+ struct pdp_t *ipnext;
+
+ /* Parameters shared by all PDP context belonging to the same MS */
+
+ void *ipif; /* IP network interface */
+ void *peer; /* Pointer to peer protocol */
+ void *asap; /* Application specific service access point */
+
+ uint64_t imsi; /* International Mobile Subscriber Identity. */
+ struct ul16_t msisdn; /* The basic MSISDN of the MS. */
+ uint8_t mnrg; /* Indicates whether the MS is marked as not reachable for PS at the HLR. (1 bit, not transmitted) */
+ uint8_t cch_sub; /* The charging characteristics for the MS, e.g. normal, prepaid, flat-rate, and/or hot billing subscription. (not transmitted) */
+ uint16_t traceref; /* Identifies a record or a collection of records for a particular trace. */
+ uint16_t tracetype; /* Indicates the type of trace. */
+ struct ul_t triggerid; /* Identifies the entity that initiated the trace. */
+ struct ul_t omcid; /* Identifies the OMC that shall receive the trace record(s). */
+ uint8_t rec_hlr; /* Indicates if HLR or VLR is performing database recovery. (1 bit, not transmitted) */
+
+ /* Parameters specific to each individual PDP context */
+
+ uint8_t pdp_id; /* Index of the PDP context. (PDP context identifier) */
+ uint8_t pdp_state; /* PDP State Packet data protocol state, INACTIVE or ACTIVE. (1 bit, not transmitted) */
+ /* struct ul_t pdp_type; * PDP type; e.g. PPP or IP. */
+ /* struct ul_t pdp_addr; * PDP address; e.g. an IP address. */
+ struct ul66_t eua; /* End user address. PDP type and address combined */
+ uint8_t pdp_dyn; /* Indicates whether PDP Address is static or dynamic. (1 bit, not transmitted) */
+ struct ul255_t apn_req; /* The APN requested. */
+ struct ul255_t apn_sub; /* The APN received from the HLR. */
+ struct ul255_t apn_use; /* The APN Network Identifier currently used. */
+ uint8_t nsapi; /* Network layer Service Access Point Identifier. (4 bit) */
+ uint16_t ti; /* Transaction Identifier. (4 or 12 bit) */
+
+ uint32_t teic_own; /* (Own Tunnel Endpoint Identifier Control) */
+ uint32_t teid_own; /* (Own Tunnel Endpoint Identifier Data I) */
+ uint32_t teic_gn; /* Tunnel Endpoint Identifier for the Gn and Gp interfaces. (Control plane) */
+ uint32_t teid_gn; /* Tunnel Endpoint Identifier for the Gn and Gp interfaces. (Data I) */
+ uint32_t tei_iu; /* Tunnel Endpoint Identifier for the Iu interface. */
+
+ uint16_t fllc; /* (Local Flow Label Control, gtp0) */
+ uint16_t fllu; /* (Local Flow Label Data I, gtp0) */
+ uint16_t flrc; /* (Remote gn/gp Flow Label Control, gtp0) */
+ uint16_t flru; /* (Remote gn/gp Flow Label Data I, gtp0) */
+
+ struct ul255_t tft; /* Traffic flow template. */
+ /*struct ul16_t sgsnc; * The IP address of the SGSN currently serving this MS. (Control plane) */
+ /*struct ul16_t sgsnu; * The IP address of the SGSN currently serving this MS. (User plane) */
+ /*struct ul16_t ggsnc; * The IP address of the GGSN currently used. (Control plane) */
+ /*struct ul16_t ggsnu; * The IP address of the GGSN currently used. (User plane) */
+
+ struct ul16_t gsnlc; /* The IP address of the local GSN. (Control plane) */
+ struct ul16_t gsnlu; /* The IP address of the local GSN. (User plane) */
+ struct ul16_t gsnrc; /* The IP address of the remote GSN. (Control plane) */
+ struct ul16_t gsnru; /* The IP address of the remote GSN. (User plane) */
+
+ uint8_t vplmn_allow; /* Specifies whether the MS is allowed to use the APN in the domain of the HPLMN only, or additionally the APN in the domain of the VPLMN. (1 bit) */
+ uint8_t qos_sub0[3]; /* The quality of service profile subscribed. */
+ uint8_t qos_req0[3]; /* The quality of service profile requested. */
+ uint8_t qos_neg0[3]; /* The quality of service profile negotiated. */
+ struct ul255_t qos_sub; /* The quality of service profile subscribed. */
+ struct ul255_t qos_req; /* The quality of service profile requested. */
+ struct ul255_t qos_neg; /* The quality of service profile negotiated. */
+ uint8_t radio_pri; /* The RLC/MAC radio priority level for uplink user data transmission. (4 bit) */
+ uint16_t flow_id; /* Packet flow identifier. */
+ /* struct ul_t bssqos_neg; * The aggregate BSS quality of service profile negotiated for the packet flow that this PDP context belongs to. (NOT GTP) */
+ uint8_t sndcpd; /* SNDCP sequence number of the next downlink N-PDU to be sent to the MS. */
+ uint8_t sndcpu; /* SNDCP sequence number of the next uplink N-PDU expected from the MS. */
+ uint8_t rec_sgsn; /* Indicates if the SGSN is performing database recovery. (1 bit, not transmitted) */
/* uint16_t gtpsnd; GTP-U sequence number of the next downlink N-PDU to be sent to the SGSN / received from the GGSN. */
/* uint16_t gtpsnu; GTP-U sequence number of the next uplink N-PDU to be received from the SGSN / sent to the GGSN */
- uint16_t gtpsntx; /* GTP-U sequence number of the next downlink N-PDU to be sent (09.60 section 8.1.1.1) */
- uint16_t gtpsnrx; /* GTP-U sequence number of the next uplink N-PDU to be received (09.60 section 8.1.1.1) */
- uint8_t pdcpsndd; /* Sequence number of the next downlink in-sequence PDCP-PDU to be sent to the MS. */
- uint8_t pdcpsndu; /* Sequence number of the next uplink in-sequence PDCP-PDU expected from the MS. */
- uint32_t cid; /* Charging identifier, identifies charging records generated by SGSN and GGSN. */
- uint16_t cch_pdp; /* The charging characteristics for this PDP context, e.g. normal, prepaid, flat-rate, and/or hot billing. */
- struct ul16_t rnc_addr;/* The IP address of the RNC currently used. */
- uint8_t reorder; /* Specifies whether the GGSN shall reorder N-PDUs received from the SGSN / Specifies whether the SGSN shall reorder N-PDUs before delivering the N-PSUs to the MS. (1 bit) */
- struct ul255_t pco_req; /* Requested packet control options. */
- struct ul255_t pco_neg; /* Negotiated packet control options. */
- uint32_t selmode; /* Selection mode. */
- struct ul255_t rattype; /* Radio Access Technology Type */
- int rattype_given; /* Radio Access Technology Type given*/
- struct ul255_t userloc; /* User Location Information */
- int userloc_given; /* User Location Information given*/
- struct ul255_t rai; /* Routing Area Information */
- int rai_given; /* Routing Area Information given*/
- struct ul255_t mstz; /* MS Time Zone */
- int mstz_given; /* MS Time Zone given*/
- struct ul255_t imeisv; /* IMEI Software Version */
- int imeisv_given; /* IMEI Software Version given*/
- int norecovery_given; /* norecovery given*/
-
- /* Additional parameters used by library */
-
- int version; /* Protocol version currently in use. 0 or 1 */
-
- uint64_t tid; /* Combination of imsi and nsapi */
- uint16_t seq; /* Sequence number of last request */
- struct sockaddr_in sa_peer; /* Address of last request */
- int fd; /* File descriptor request was received on */
-
- uint8_t teic_confirmed; /* 0: Not confirmed. 1: Confirmed */
-
- /* Parameters used for secondary activation procedure (tei data) */
- /* If (secondary == 1) then teic_own indicates linked PDP context */
- uint8_t secondary; /* 0: Primary (control). 1: Secondary (data only) */
- uint8_t nodata; /* 0: User plane PDP context. 1: No user plane */
-
- /* Secondary contexts of this primary context */
- uint32_t secondary_tei[PDP_MAXNSAPI];
-
- /* IP address used for Create and Update PDP Context Requests */
- struct in_addr hisaddr0; /* Server address */
- struct in_addr hisaddr1; /* Server address */
-
- /* to be used by libgtp callers/users (to attach their own private state) */
- void *priv;
+ uint16_t gtpsntx; /* GTP-U sequence number of the next downlink N-PDU to be sent (09.60 section 8.1.1.1) */
+ uint16_t gtpsnrx; /* GTP-U sequence number of the next uplink N-PDU to be received (09.60 section 8.1.1.1) */
+ uint8_t pdcpsndd; /* Sequence number of the next downlink in-sequence PDCP-PDU to be sent to the MS. */
+ uint8_t pdcpsndu; /* Sequence number of the next uplink in-sequence PDCP-PDU expected from the MS. */
+ uint32_t cid; /* Charging identifier, identifies charging records generated by SGSN and GGSN. */
+ uint16_t cch_pdp; /* The charging characteristics for this PDP context, e.g. normal, prepaid, flat-rate, and/or hot billing. */
+ struct ul16_t rnc_addr; /* The IP address of the RNC currently used. */
+ uint8_t reorder; /* Specifies whether the GGSN shall reorder N-PDUs received from the SGSN / Specifies whether the SGSN shall reorder N-PDUs before delivering the N-PSUs to the MS. (1 bit) */
+ struct ul255_t pco_req; /* Requested packet control options. */
+ struct ul255_t pco_neg; /* Negotiated packet control options. */
+ uint32_t selmode; /* Selection mode. */
+ struct ul255_t rattype; /* Radio Access Technology Type */
+ int rattype_given; /* Radio Access Technology Type given */
+ struct ul255_t userloc; /* User Location Information */
+ int userloc_given; /* User Location Information given */
+ struct ul255_t rai; /* Routing Area Information */
+ int rai_given; /* Routing Area Information given */
+ struct ul255_t mstz; /* MS Time Zone */
+ int mstz_given; /* MS Time Zone given */
+ struct ul255_t imeisv; /* IMEI Software Version */
+ int imeisv_given; /* IMEI Software Version given */
+ int norecovery_given; /* norecovery given */
+
+ /* Additional parameters used by library */
+
+ int version; /* Protocol version currently in use. 0 or 1 */
+
+ uint64_t tid; /* Combination of imsi and nsapi */
+ uint16_t seq; /* Sequence number of last request */
+ struct sockaddr_in sa_peer; /* Address of last request */
+ int fd; /* File descriptor request was received on */
+
+ uint8_t teic_confirmed; /* 0: Not confirmed. 1: Confirmed */
+
+ /* Parameters used for secondary activation procedure (tei data) */
+ /* If (secondary == 1) then teic_own indicates linked PDP context */
+ uint8_t secondary; /* 0: Primary (control). 1: Secondary (data only) */
+ uint8_t nodata; /* 0: User plane PDP context. 1: No user plane */
+
+ /* Secondary contexts of this primary context */
+ uint32_t secondary_tei[PDP_MAXNSAPI];
+
+ /* IP address used for Create and Update PDP Context Requests */
+ struct in_addr hisaddr0; /* Server address */
+ struct in_addr hisaddr1; /* Server address */
+
+ /* to be used by libgtp callers/users (to attach their own private state) */
+ void *priv;
};
-
/* functions related to pdp_t management */
int pdp_init();
int pdp_newpdp(struct pdp_t **pdp, uint64_t imsi, uint8_t nsapi,
@@ -245,7 +242,6 @@ int pdp_tidset(struct pdp_t *pdp, uint64_t tid);
int pdp_tiddel(struct pdp_t *pdp);
int pdp_tidget(struct pdp_t **pdp, uint64_t tid);
-
/*
int pdp_iphash(void* ipif, struct ul66_t *eua);
int pdp_ipset(struct pdp_t *pdp, void* ipif, struct ul66_t *eua);
@@ -256,6 +252,6 @@ int pdp_ipget(struct pdp_t **pdp, void* ipif, struct ul66_t *eua);
int pdp_ntoeua(struct in_addr *src, struct ul66_t *eua);
int pdp_euaton(struct ul66_t *eua, struct in_addr *dst);
uint64_t pdp_gettid(uint64_t imsi, uint8_t nsapi);
-int ulcpy(void* dst, void* src, size_t size);
+int ulcpy(void *dst, void *src, size_t size);
-#endif /* !_PDP_H */
+#endif /* !_PDP_H */