aboutsummaryrefslogtreecommitdiffstats
path: root/octpkt
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-01-18 20:42:15 +0100
committerHarald Welte <laforge@gnumonks.org>2016-01-18 20:46:14 +0100
commit31d4176efde046ba837e74f990e3454bf98f73de (patch)
tree44a4d91410f142f8dfad5b69d83f2e9dd5745b8c /octpkt
initial check-in of OCTSDR-2G headers
Version is OCTSDR_GSM-02.03.00-B560 (2015/08/07)
Diffstat (limited to 'octpkt')
-rw-r--r--octpkt/octpkt_hdr.h108
-rw-r--r--octpkt/octpkt_hdr_swap.h78
-rw-r--r--octpkt/octpkt_hdrxl.h95
-rw-r--r--octpkt/octpkt_hdrxl_swap.h69
4 files changed, 350 insertions, 0 deletions
diff --git a/octpkt/octpkt_hdr.h b/octpkt/octpkt_hdr.h
new file mode 100644
index 0000000..e33025e
--- /dev/null
+++ b/octpkt/octpkt_hdr.h
@@ -0,0 +1,108 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File: OCTPKT_HDR.h
+
+Copyright (c) 2015 Octasic Inc. All rights reserved.
+
+Description:
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+Release: OCTSDR Software Development Kit OCTSDR_GSM-02.03.00-B560 (2015/08/07)
+
+$Revision: $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+
+#ifndef __OCTPKT_HDR_H__
+#define __OCTPKT_HDR_H__
+
+
+/***************************** INCLUDE FILES *******************************/
+#include "../octdev_types.h"
+
+
+/************************ COMMON DEFINITIONS *******************************/
+
+#define cOCTPKT_HDR_ETHERTYPE 0x5200
+
+/*-------------------------------------------------------------------------------------
+ OctPkt-Packet Format Values
+-------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------
+ tOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK :
+-------------------------------------------------------------------------------------*/
+#define tOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK tOCT_UINT32
+
+#define cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_FORMAT_BIT_MASK 0x000000FF
+#define cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_FORMAT_BIT_OFFSET 24
+#define cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_FORMAT ((tOCT_UINT32)(cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_FORMAT_BIT_MASK<<cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_FORMAT_BIT_OFFSET) )
+
+#define cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_TRACE_BIT_MASK 0x00000001
+#define cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_TRACE_BIT_OFFSET 23
+#define cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_TRACE ((tOCT_UINT32)(cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_TRACE_BIT_MASK<<cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_TRACE_BIT_OFFSET) )
+
+#define cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_CONTROL_PROTOCOL_TYPE_BIT_MASK 0x0000000F
+#define cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_CONTROL_PROTOCOL_TYPE_BIT_OFFSET 11
+#define cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_CONTROL_PROTOCOL_TYPE ((tOCT_UINT32)(cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_CONTROL_PROTOCOL_TYPE_BIT_MASK<<cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_CONTROL_PROTOCOL_TYPE_BIT_OFFSET) )
+
+#define cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_LENGTH_BIT_MASK 0x000007FF
+#define cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_LENGTH_BIT_OFFSET 0
+#define cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_LENGTH ((tOCT_UINT32)(cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_LENGTH_BIT_MASK<<cOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_LENGTH_BIT_OFFSET) )
+
+
+/*-------------------------------------------------------------------------------------
+ tOCTPKT_HDR_CONTROL_PROTOCOL_TYPE_ENUM :
+-------------------------------------------------------------------------------------*/
+#define tOCTPKT_HDR_CONTROL_PROTOCOL_TYPE_ENUM tOCT_UINT32
+
+#define cOCTPKT_HDR_CONTROL_PROTOCOL_TYPE_ENUM_OCTVOCNET 0x0 /* Vocallo MGW Control Protocol */
+#define cOCTPKT_HDR_CONTROL_PROTOCOL_TYPE_ENUM_OCTMFA 0x1 /* Media Flow Aggregator Control Protocol */
+#define cOCTPKT_HDR_CONTROL_PROTOCOL_TYPE_ENUM_LTE_FAPI 0x2 /* SDR LTE femtocells API Protocol */
+#define cOCTPKT_HDR_CONTROL_PROTOCOL_TYPE_ENUM_TEST 0xE /* TEST Protocol */
+#define cOCTPKT_HDR_CONTROL_PROTOCOL_TYPE_ENUM_NONE 0xFFFFFFFF /* Not used */
+
+
+/*-------------------------------------------------------------------------------------
+ tOCTPKT_HDR
+ COMMON Packet Header
+ 32-bit value
+ bits[31:24] = Format
+ bit[23] = Trace Flag
+ bits[22:15] = 0=Reserved
+ bits[14:11] = Control Protocol Type
+ bits[10:0] = Total Packet Size in bytes
+
+ Members:
+ ul_Format_Trace_Length
+-------------------------------------------------------------------------------------*/
+typedef struct
+{
+ tOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK ul_Format_Trace_Length;
+
+} tOCTPKT_HDR;
+
+
+/*-------------------------------------------------------------------------------------
+ tOCTPKT_HDR_TYPE_ENUM :
+-------------------------------------------------------------------------------------*/
+#define tOCTPKT_HDR_TYPE_ENUM tOCT_UINT32
+
+#define cOCTPKT_HDR_TYPE_ENUM_NONE 0 /* Unused PktHdr */
+#define cOCTPKT_HDR_TYPE_ENUM_NORMAL 1 /* Normal OctPktHdr */
+#define cOCTPKT_HDR_TYPE_ENUM_XL 2 /* XL OctPktHdr */
+
+
+#endif /* __OCTPKT_HDR_H__ */
+
diff --git a/octpkt/octpkt_hdr_swap.h b/octpkt/octpkt_hdr_swap.h
new file mode 100644
index 0000000..86af8f4
--- /dev/null
+++ b/octpkt/octpkt_hdr_swap.h
@@ -0,0 +1,78 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+
+File: octpkt_hdr_swap.h
+
+Copyright (c) 2015 Octasic Inc. All rights reserved.
+
+Description:
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+Release: OCTSDR Software Development Kit OCTSDR_GSM-02.03.00-B560 (2015/08/07)
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#ifndef __OCTPKT_HDR_SWAP_H__
+#define __OCTPKT_HDR_SWAP_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************** INCLUDE FILES *******************************/
+#include "../octvc1/octvc1_swap_hdrs.h"
+#include "octpkt_hdr.h"
+
+/********************************* MACROS **********************************/
+
+
+#if defined( _OCT_ENDIAN_TYPE_LE_ )
+#define mOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_SWAP( pType ){ \
+ *((tOCT_UINT32 *)pType) = mOCT_SWAP32_IF_LE( *((tOCT_UINT32 *)pType) ); }
+#else
+
+#define mOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_SWAP( pType )
+
+#endif /* _OCT_ENDIAN_TYPE_LE_ */
+
+#if defined( _OCT_ENDIAN_TYPE_LE_ )
+#define mOCTPKT_HDR_CONTROL_PROTOCOL_TYPE_ENUM_SWAP( pType ){ \
+ *((tOCT_UINT32 *)pType) = mOCT_SWAP32_IF_LE( *((tOCT_UINT32 *)pType) ); }
+#else
+
+#define mOCTPKT_HDR_CONTROL_PROTOCOL_TYPE_ENUM_SWAP( pType )
+
+#endif /* _OCT_ENDIAN_TYPE_LE_ */
+
+#if defined( _OCT_ENDIAN_TYPE_LE_ )
+#define mOCTPKT_HDR_SWAP( _f_pParms ){ tOCTPKT_HDR * pOCTPKT_HDR = (_f_pParms); SWAP_UNUSED(pOCTPKT_HDR)\
+ { mOCTPKT_HDR_FORMAT_PROTO_TYPE_LEN_MASK_SWAP( &((tOCTPKT_HDR *)pOCTPKT_HDR)->ul_Format_Trace_Length ); } \
+}
+#else
+#define mOCTPKT_HDR_SWAP( pOCTPKT_HDR )
+#endif /* _OCT_ENDIAN_TYPE_LE_ */
+
+#if defined( _OCT_ENDIAN_TYPE_LE_ )
+#define mOCTPKT_HDR_TYPE_ENUM_SWAP( pType ){ \
+ *((tOCT_UINT32 *)pType) = mOCT_SWAP32_IF_LE( *((tOCT_UINT32 *)pType) ); }
+#else
+
+#define mOCTPKT_HDR_TYPE_ENUM_SWAP( pType )
+
+#endif /* _OCT_ENDIAN_TYPE_LE_ */
+
+#ifdef __cplusplus
+}
+
+#endif
+
+#endif /* __OCTPKT_HDR_SWAP_H__ */
diff --git a/octpkt/octpkt_hdrxl.h b/octpkt/octpkt_hdrxl.h
new file mode 100644
index 0000000..113cdec
--- /dev/null
+++ b/octpkt/octpkt_hdrxl.h
@@ -0,0 +1,95 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
+
+File: OCTPKT_HDRXL.h
+
+Copyright (c) 2015 Octasic Inc. All rights reserved.
+
+Description:
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+Release: OCTSDR Software Development Kit OCTSDR_GSM-02.03.00-B560 (2015/08/07)
+
+$Revision: $
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+
+#ifndef __OCTPKT_HDRXL_H__
+#define __OCTPKT_HDRXL_H__
+
+
+/***************************** INCLUDE FILES *******************************/
+#include "../octdev_types.h"
+#include "octpkt_hdr.h"
+
+
+/************************ COMMON DEFINITIONS *******************************/
+
+#define cOCTPKT_HDRXL_ETHERTYPE 0x5201
+
+/*-------------------------------------------------------------------------------------
+ OctPkt-Packet Format Values
+-------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------
+ tOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK :
+-------------------------------------------------------------------------------------*/
+#define tOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK tOCT_UINT32
+
+#define cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_FORMAT_BIT_MASK 0x000000FF
+#define cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_FORMAT_BIT_OFFSET 16
+#define cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_FORMAT ((tOCT_UINT32)(cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_FORMAT_BIT_MASK<<cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_FORMAT_BIT_OFFSET) )
+
+#define cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_CONTROL_PROTOCOL_TYPE_BIT_MASK 0x0000000F
+#define cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_CONTROL_PROTOCOL_TYPE_BIT_OFFSET 28
+#define cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_CONTROL_PROTOCOL_TYPE ((tOCT_UINT32)(cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_CONTROL_PROTOCOL_TYPE_BIT_MASK<<cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_CONTROL_PROTOCOL_TYPE_BIT_OFFSET) )
+
+#define cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_LENGTH_BIT_MASK 0x0000FFFF
+#define cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_LENGTH_BIT_OFFSET 0
+#define cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_LENGTH ((tOCT_UINT32)(cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_LENGTH_BIT_MASK<<cOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_LENGTH_BIT_OFFSET) )
+
+
+/*-------------------------------------------------------------------------------------
+ tOCTPKT_HDRXL
+ COMMON Packet Header Extended Length
+ 32-bit value
+ bits[31:28] = Control Protocol Type
+ bits[27:24] = Reserved
+ bits[23:16] = Format (depend of the Protocol)
+ bits[15:0] = Total Packet Length (size in bytes)
+
+ Members:
+ ul_Proto_Format_Length
+-------------------------------------------------------------------------------------*/
+typedef struct
+{
+ tOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK ul_Proto_Format_Length;
+
+} tOCTPKT_HDRXL;
+
+/*-------------------------------------------------------------------------------------
+ tOCTPKT_HDRXL_ETH
+ Ethernet alignement header
+
+ Members:
+ usReserved
+-------------------------------------------------------------------------------------*/
+typedef struct
+{
+ tOCT_UINT16 usReserved;
+
+} tOCTPKT_HDRXL_ETH;
+
+
+#endif /* __OCTPKT_HDRXL_H__ */
+
diff --git a/octpkt/octpkt_hdrxl_swap.h b/octpkt/octpkt_hdrxl_swap.h
new file mode 100644
index 0000000..7ebb240
--- /dev/null
+++ b/octpkt/octpkt_hdrxl_swap.h
@@ -0,0 +1,69 @@
+/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+
+File: octpkt_hdrxl_swap.h
+
+Copyright (c) 2015 Octasic Inc. All rights reserved.
+
+Description:
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+Release: OCTSDR Software Development Kit OCTSDR_GSM-02.03.00-B560 (2015/08/07)
+
+\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
+#ifndef __OCTPKT_HDRXL_SWAP_H__
+#define __OCTPKT_HDRXL_SWAP_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************** INCLUDE FILES *******************************/
+#include "../octvc1/octvc1_swap_hdrs.h"
+#include "octpkt_hdrxl.h"
+
+/********************************* MACROS **********************************/
+
+
+#if defined( _OCT_ENDIAN_TYPE_LE_ )
+#define mOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_SWAP( pType ){ \
+ *((tOCT_UINT32 *)pType) = mOCT_SWAP32_IF_LE( *((tOCT_UINT32 *)pType) ); }
+#else
+
+#define mOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_SWAP( pType )
+
+#endif /* _OCT_ENDIAN_TYPE_LE_ */
+
+#if defined( _OCT_ENDIAN_TYPE_LE_ )
+#define mOCTPKT_HDRXL_SWAP( _f_pParms ){ tOCTPKT_HDRXL * pOCTPKT_HDRXL = (_f_pParms); SWAP_UNUSED(pOCTPKT_HDRXL)\
+ { mOCTPKT_HDRXL_FORMAT_PROTO_TYPE_LEN_MASK_SWAP( &((tOCTPKT_HDRXL *)pOCTPKT_HDRXL)->ul_Proto_Format_Length ); } \
+}
+#else
+#define mOCTPKT_HDRXL_SWAP( pOCTPKT_HDRXL )
+#endif /* _OCT_ENDIAN_TYPE_LE_ */
+
+#if defined( _OCT_ENDIAN_TYPE_LE_ )
+#define mOCTPKT_HDRXL_ETH_SWAP( _f_pParms ){ tOCTPKT_HDRXL_ETH * pOCTPKT_HDRXL_ETH = (_f_pParms); SWAP_UNUSED(pOCTPKT_HDRXL_ETH)\
+ ((tOCTPKT_HDRXL_ETH *)pOCTPKT_HDRXL_ETH)->usReserved = \
+ mOCT_SWAP16_IF_LE(((tOCTPKT_HDRXL_ETH *)pOCTPKT_HDRXL_ETH)->usReserved); \
+}
+#else
+#define mOCTPKT_HDRXL_ETH_SWAP( pOCTPKT_HDRXL_ETH )
+#endif /* _OCT_ENDIAN_TYPE_LE_ */
+
+#ifdef __cplusplus
+}
+
+#endif
+
+#endif /* __OCTPKT_HDRXL_SWAP_H__ */