Commit faa51ec4 authored by Cedric Roux's avatar Cedric Roux

- Use typedef for enums/structs

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4562 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 0aec555a
This diff is collapsed.
/***************************************************************************** /*****************************************************************************
Eurecom OpenAirInterface 3 Eurecom OpenAirInterface 3
Copyright(c) 2012 Eurecom Copyright(c) 2012 Eurecom
Source commonDef.h Source commonDef.h
Version 0.1 Version 0.1
Date 2012/02/27 Date 2012/02/27
Product NAS stack Product NAS stack
Subsystem include Subsystem include
Author Frederic Maurel Author Frederic Maurel
Description Contains global common definitions Description Contains global common definitions
*****************************************************************************/ *****************************************************************************/
#ifndef __COMMONDEF_H__ #ifndef __COMMONDEF_H__
...@@ -27,14 +27,14 @@ Description Contains global common definitions ...@@ -27,14 +27,14 @@ Description Contains global common definitions
/********************* G L O B A L C O N S T A N T S *******************/ /********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/ /****************************************************************************/
#define RETURNok (0) #define RETURNok (0)
#define RETURNerror (-1) #define RETURNerror (-1)
#ifndef FALSE #ifndef FALSE
#define FALSE (0) #define FALSE (0)
#endif #endif
#ifndef TRUE #ifndef TRUE
#define TRUE (1) #define TRUE (1)
#endif #endif
/* /*
...@@ -42,7 +42,7 @@ Description Contains global common definitions ...@@ -42,7 +42,7 @@ Description Contains global common definitions
* where the NAS application is executed and where are located files * where the NAS application is executed and where are located files
* where non-volatile data are stored * where non-volatile data are stored
*/ */
#define DEFAULT_NAS_PATH "PWD" #define DEFAULT_NAS_PATH "PWD"
/****************************************************************************/ /****************************************************************************/
/************************ G L O B A L T Y P E S ************************/ /************************ G L O B A L T Y P E S ************************/
...@@ -50,34 +50,34 @@ Description Contains global common definitions ...@@ -50,34 +50,34 @@ Description Contains global common definitions
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Standard data type definitions Standard data type definitions
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
typedef int8_t SByte_t; /* 8 bit signed integer */ typedef int8_t SByte_t; /* 8 bit signed integer */
typedef int8_t Int8_t; /* 8 bit signed integer */ typedef int8_t Int8_t; /* 8 bit signed integer */
typedef int16_t Int16_t; /* 16 bit signed integer */ typedef int16_t Int16_t; /* 16 bit signed integer */
typedef int32_t Int32_t; /* 32 bit signed integer */ typedef int32_t Int32_t; /* 32 bit signed integer */
typedef int64_t Int64_t; /* 64 bit signed integer */ typedef int64_t Int64_t; /* 64 bit signed integer */
typedef uint8_t Byte_t; /* 8 bit unsigned integer */ typedef uint8_t Byte_t; /* 8 bit unsigned integer */
typedef uint8_t UInt8_t; /* 8 bit unsigned integer */ typedef uint8_t UInt8_t; /* 8 bit unsigned integer */
typedef uint16_t UInt16_t; /* 16 bit unsigned integer */ typedef uint16_t UInt16_t; /* 16 bit unsigned integer */
typedef uint32_t UInt32_t; /* 32 bit unsigned integer */ typedef uint32_t UInt32_t; /* 32 bit unsigned integer */
typedef uint64_t UInt64_t; /* 64 bit unsigned integer */ typedef uint64_t UInt64_t; /* 64 bit unsigned integer */
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Common NAS data type definitions Common NAS data type definitions
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
typedef UInt8_t Stat_t; /* Registration status */ typedef UInt8_t Stat_t; /* Registration status */
typedef UInt16_t lac_t; /* Location Area Code */ typedef UInt16_t lac_t; /* Location Area Code */
typedef UInt8_t rac_t; /* Routing Area Code */ typedef UInt8_t rac_t; /* Routing Area Code */
typedef UInt16_t tac_t; /* Tracking Area Code */ typedef UInt16_t tac_t; /* Tracking Area Code */
typedef UInt32_t ci_t; /* Cell Identifier */ typedef UInt32_t ci_t; /* Cell Identifier */
typedef UInt8_t AcT_t; /* Access Technology */ typedef UInt8_t AcT_t; /* Access Technology */
/* /*
* International Mobile Subscriber Identity * International Mobile Subscriber Identity
...@@ -85,28 +85,28 @@ typedef UInt8_t AcT_t; /* Access Technology */ ...@@ -85,28 +85,28 @@ typedef UInt8_t AcT_t; /* Access Technology */
typedef struct { typedef struct {
Byte_t length; Byte_t length;
union { union {
struct { struct {
Byte_t digit15:4; Byte_t digit15:4;
Byte_t digit14:4; Byte_t digit14:4;
Byte_t digit13:4; Byte_t digit13:4;
Byte_t digit12:4; Byte_t digit12:4;
Byte_t digit11:4; Byte_t digit11:4;
Byte_t digit10:4; Byte_t digit10:4;
Byte_t digit9:4; Byte_t digit9:4;
Byte_t digit8:4; Byte_t digit8:4;
Byte_t digit7:4; Byte_t digit7:4;
Byte_t digit6:4; Byte_t digit6:4;
Byte_t digit5:4; Byte_t digit5:4;
Byte_t digit4:4; Byte_t digit4:4;
Byte_t digit3:4; Byte_t digit3:4;
Byte_t digit2:4; Byte_t digit2:4;
Byte_t digit1:4; Byte_t digit1:4;
#define EVEN_PARITY 0 #define EVEN_PARITY 0
#define ODD_PARITY 1 #define ODD_PARITY 1
Byte_t parity:4; Byte_t parity:4;
} num; } num;
#define IMSI_SIZE 8 #define IMSI_SIZE 8
Byte_t value[IMSI_SIZE]; Byte_t value[IMSI_SIZE];
} u; } u;
} imsi_t; } imsi_t;
...@@ -115,32 +115,32 @@ typedef struct { ...@@ -115,32 +115,32 @@ typedef struct {
*/ */
typedef struct { typedef struct {
Byte_t ext:1; Byte_t ext:1;
/* Type Of Number */ /* Type Of Number */
#define MSISDN_TON_UNKNOWKN 0b000 #define MSISDN_TON_UNKNOWKN 0b000
#define MSISDN_TON_INTERNATIONAL 0b001 #define MSISDN_TON_INTERNATIONAL 0b001
#define MSISDN_TON_NATIONAL 0b010 #define MSISDN_TON_NATIONAL 0b010
#define MSISDN_TON_NETWORK 0b011 #define MSISDN_TON_NETWORK 0b011
#define MSISDN_TON_SUBCRIBER 0b100 #define MSISDN_TON_SUBCRIBER 0b100
#define MSISDN_TON_ABBREVIATED 0b110 #define MSISDN_TON_ABBREVIATED 0b110
#define MSISDN_TON_RESERVED 0b111 #define MSISDN_TON_RESERVED 0b111
Byte_t ton:3; Byte_t ton:3;
/* Numbering Plan Identification */ /* Numbering Plan Identification */
#define MSISDN_NPI_UNKNOWN 0b0000 #define MSISDN_NPI_UNKNOWN 0b0000
#define MSISDN_NPI_ISDN_TELEPHONY 0b0001 #define MSISDN_NPI_ISDN_TELEPHONY 0b0001
#define MSISDN_NPI_GENERIC 0b0010 #define MSISDN_NPI_GENERIC 0b0010
#define MSISDN_NPI_DATA 0b0011 #define MSISDN_NPI_DATA 0b0011
#define MSISDN_NPI_TELEX 0b0100 #define MSISDN_NPI_TELEX 0b0100
#define MSISDN_NPI_MARITIME_MOBILE 0b0101 #define MSISDN_NPI_MARITIME_MOBILE 0b0101
#define MSISDN_NPI_LAND_MOBILE 0b0110 #define MSISDN_NPI_LAND_MOBILE 0b0110
#define MSISDN_NPI_ISDN_MOBILE 0b0111 #define MSISDN_NPI_ISDN_MOBILE 0b0111
#define MSISDN_NPI_PRIVATE 0b1110 #define MSISDN_NPI_PRIVATE 0b1110
#define MSISDN_NPI_RESERVED 0b1111 #define MSISDN_NPI_RESERVED 0b1111
Byte_t npi:4; Byte_t npi:4;
/* Dialing Number */ /* Dialing Number */
struct { struct {
Byte_t lsb:4; Byte_t lsb:4;
Byte_t msb:4; Byte_t msb:4;
#define MSISDN_DIGIT_SIZE 10 #define MSISDN_DIGIT_SIZE 10
} digit[MSISDN_DIGIT_SIZE]; } digit[MSISDN_DIGIT_SIZE];
} msisdn_t; } msisdn_t;
...@@ -166,55 +166,55 @@ typedef struct { ...@@ -166,55 +166,55 @@ typedef struct {
* Location Area Identification * Location Area Identification
*/ */
typedef struct { typedef struct {
plmn_t plmn; /* <MCC> + <MNC> */ plmn_t plmn; /* <MCC> + <MNC> */
lac_t lac; /* Location Area Code */ lac_t lac; /* Location Area Code */
} lai_t; } lai_t;
/* /*
* GPRS Routing Area Identification * GPRS Routing Area Identification
*/ */
typedef struct { typedef struct {
plmn_t plmn; /* <MCC> + <MNC> */ plmn_t plmn; /* <MCC> + <MNC> */
lac_t lac; /* Location Area Code */ lac_t lac; /* Location Area Code */
rac_t rac; /* Routing Area Code */ rac_t rac; /* Routing Area Code */
} RAI_t; } RAI_t;
/* /*
* EPS Tracking Area Identification * EPS Tracking Area Identification
*/ */
typedef struct { typedef struct {
plmn_t plmn; /* <MCC> + <MNC> */ plmn_t plmn; /* <MCC> + <MNC> */
tac_t tac; /* Tracking Area Code */ tac_t tac; /* Tracking Area Code */
} tai_t; } tai_t;
/* /*
* EPS Globally Unique MME Identity * EPS Globally Unique MME Identity
*/ */
typedef struct { typedef struct {
plmn_t plmn; /* <MCC> + <MNC> */ plmn_t plmn; /* <MCC> + <MNC> */
UInt16_t MMEgid; /* MME group identifier */ UInt16_t MMEgid; /* MME group identifier */
UInt8_t MMEcode; /* MME code */ UInt8_t MMEcode; /* MME code */
} gummei_t; } gummei_t;
/* /*
* EPS Globally Unique Temporary UE Identity * EPS Globally Unique Temporary UE Identity
*/ */
typedef struct { typedef struct {
gummei_t gummei; /* Globally Unique MME Identity */ gummei_t gummei; /* Globally Unique MME Identity */
UInt32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */ UInt32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */
} GUTI_t; } GUTI_t;
/* Checks PLMN validity */ /* Checks PLMN validity */
#define PLMN_IS_VALID(plmn) (((plmn).MCCdigit1 & \ #define PLMN_IS_VALID(plmn) (((plmn).MCCdigit1 & \
(plmn).MCCdigit2 & \ (plmn).MCCdigit2 & \
(plmn).MCCdigit3) != 0x0F) (plmn).MCCdigit3) != 0x0F)
/* Checks TAC validity */ /* Checks TAC validity */
#define TAC_IS_VALID(tac) (((tac) != 0x0000) && ((tac) != 0xFFF0)) #define TAC_IS_VALID(tac) (((tac) != 0x0000) && ((tac) != 0xFFF0))
/* Checks TAI validity */ /* Checks TAI validity */
#define TAI_IS_VALID(tai) (PLMN_IS_VALID((tai).plmn) && \ #define TAI_IS_VALID(tai) (PLMN_IS_VALID((tai).plmn) && \
TAC_IS_VALID((tai).tac)) TAC_IS_VALID((tai).tac))
/* /*
* A list of PLMNs * A list of PLMNs
*/ */
...@@ -236,7 +236,8 @@ typedef struct { ...@@ -236,7 +236,8 @@ typedef struct {
* location change, new PLMN becomes available) is notified by the * location change, new PLMN becomes available) is notified by the
* EPS Mobility Management sublayer * EPS Mobility Management sublayer
*/ */
typedef int (*emm_indication_callback_t) (Stat_t, tac_t, ci_t, AcT_t, const char*, size_t); typedef int (*emm_indication_callback_t) (Stat_t, tac_t, ci_t, AcT_t,
const char *, size_t);
/****************************************************************************/ /****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/ /******************** G L O B A L V A R I A B L E S ********************/
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment