├── .gitignore ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── LICENSE ├── Makefile.am ├── Makefile.in ├── NEWS ├── README.md ├── aclocal.m4 ├── common ├── NwError.h ├── NwEvt.h ├── NwLog.h ├── NwMem.c ├── NwMem.h ├── NwTypes.h ├── NwUtils.h ├── queue.h └── tree.h ├── configure ├── configure.ac ├── depcomp ├── install-sh ├── missing ├── nw-event ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── depcomp ├── include │ ├── NwEvent.h │ └── queue.h ├── install-sh ├── missing ├── src │ ├── Makefile.am │ ├── Makefile.in │ └── NwEvent.c └── test-app │ ├── Makefile.am │ ├── Makefile.in │ ├── event-test.c │ └── time-test.c ├── nw-gre ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── depcomp ├── include │ ├── NwGreLog.h │ ├── NwGrePrivate.h │ ├── NwGreTrxn.h │ ├── NwGreTunnelEndPoint.h │ ├── queue.h │ └── tree.h ├── install-sh ├── missing ├── shared │ ├── NwGre.h │ ├── NwGreError.h │ ├── NwGreIe.h │ ├── NwGreMsg.h │ ├── NwTypes.h │ └── NwUtils.h ├── src │ ├── Makefile.am │ ├── Makefile.in │ ├── NwGre.c │ ├── NwGreMsg.c │ ├── NwGreTrxn.c │ └── NwGreTunnelEndPoint.c └── test-app │ ├── Makefile.am │ ├── Makefile.in │ └── nw-helloworld │ ├── Makefile.am │ ├── Makefile.in │ ├── NwEvt.h │ ├── NwMiniLogMgrEntity.c │ ├── NwMiniLogMgrEntity.h │ ├── NwMiniTmrMgrEntity.c │ ├── NwMiniTmrMgrEntity.h │ ├── NwMiniUdpEntity.c │ ├── NwMiniUdpEntity.h │ ├── NwMiniUlpEntity.c │ ├── NwMiniUlpEntity.h │ └── helloworld.c ├── nw-gtpv1u ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── depcomp ├── include │ ├── NwGtpv1uLog.h │ ├── NwGtpv1uPrivate.h │ ├── NwGtpv1uTrxn.h │ ├── NwGtpv1uTunnelEndPoint.h │ ├── queue.h │ └── tree.h ├── install-sh ├── missing ├── shared │ ├── NwGtpv1u.h │ ├── NwGtpv1uError.h │ ├── NwGtpv1uIe.h │ ├── NwGtpv1uMsg.h │ ├── NwLog.h │ ├── NwTypes.h │ └── NwUtils.h ├── src │ ├── Makefile.am │ ├── Makefile.in │ ├── NwGtpv1u.c │ ├── NwGtpv1uMsg.c │ ├── NwGtpv1uTrxn.c │ └── NwGtpv1uTunnelEndPoint.c └── test-app │ ├── Makefile.am │ ├── Makefile.in │ └── nw-helloworld │ ├── Makefile.am │ ├── Makefile.in │ ├── NwEvt.h │ ├── NwMiniLogMgrEntity.c │ ├── NwMiniLogMgrEntity.h │ ├── NwMiniTmrMgrEntity.c │ ├── NwMiniTmrMgrEntity.h │ ├── NwMiniUdpEntity.c │ ├── NwMiniUdpEntity.h │ ├── NwMiniUlpEntity.c │ ├── NwMiniUlpEntity.h │ └── helloworld.c ├── nw-gtpv2c ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── depcomp ├── include │ ├── NwGtpv2cLog.h │ ├── NwGtpv2cMsgIeParseInfo.h │ ├── NwGtpv2cPrivate.h │ ├── NwGtpv2cTrxn.h │ ├── NwGtpv2cTunnel.h │ ├── queue.h │ └── tree.h ├── install-sh ├── missing ├── shared │ ├── NwError.h │ ├── NwGtpv2c.h │ ├── NwGtpv2cIe.h │ ├── NwGtpv2cMsg.h │ ├── NwGtpv2cMsgParser.h │ ├── NwLog.h │ ├── NwTypes.h │ └── NwUtils.h ├── src │ ├── Makefile.am │ ├── Makefile.in │ ├── NwGtpv2c.c │ ├── NwGtpv2cMsg.c │ ├── NwGtpv2cMsgIeParseInfo.c │ ├── NwGtpv2cMsgParser.c │ ├── NwGtpv2cTrxn.c │ └── NwGtpv2cTunnel.c └── test-app │ ├── Makefile.am │ ├── Makefile.in │ ├── nw-egtping │ ├── Makefile.am │ ├── Makefile.in │ ├── NwEgtPingMain.c │ ├── NwEvt.h │ ├── NwMiniLogMgrEntity.c │ ├── NwMiniLogMgrEntity.h │ ├── NwMiniTmrMgrEntity.c │ ├── NwMiniTmrMgrEntity.h │ ├── NwMiniUdpEntity.c │ ├── NwMiniUdpEntity.h │ ├── NwMiniUlpEntity.c │ └── NwMiniUlpEntity.h │ └── nw-helloworld │ ├── Makefile.am │ ├── Makefile.in │ ├── NwEvt.h │ ├── NwMiniLogMgrEntity.c │ ├── NwMiniLogMgrEntity.h │ ├── NwMiniTmrMgrEntity.c │ ├── NwMiniTmrMgrEntity.h │ ├── NwMiniUdpEntity.c │ ├── NwMiniUdpEntity.h │ ├── NwMiniUlpEntity.c │ ├── NwMiniUlpEntity.h │ └── helloworld.c ├── nw-ipv4 ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── depcomp ├── include │ ├── NwIpv4Log.h │ ├── NwIpv4Private.h │ ├── NwIpv4TunnelEndPoint.h │ ├── queue.h │ └── tree.h ├── install-sh ├── missing ├── shared │ ├── NwIpv4.h │ ├── NwIpv4Error.h │ ├── NwIpv4Ie.h │ ├── NwIpv4Msg.h │ ├── NwTypes.h │ └── NwUtils.h ├── src │ ├── Makefile.am │ ├── Makefile.in │ ├── NwIpv4.c │ ├── NwIpv4Msg.c │ └── NwIpv4TunnelEndPoint.c └── test-app │ ├── Makefile.am │ ├── Makefile.in │ └── nw-helloworld │ ├── Makefile.am │ ├── Makefile.in │ ├── NwEvt.h │ ├── NwMiniLlpEntity.c │ ├── NwMiniLlpEntity.h │ ├── NwMiniLogMgrEntity.c │ ├── NwMiniLogMgrEntity.h │ ├── NwMiniTmrMgrEntity.c │ ├── NwMiniTmrMgrEntity.h │ ├── NwMiniUlpEntity.c │ ├── NwMiniUlpEntity.h │ └── helloworld.c ├── nw-mme-emu ├── Makefile.am ├── Makefile.in ├── NwMmeDpe.c ├── NwMmeDpe.h ├── NwMmeLog.h ├── NwMmeMain.c ├── NwMmeUe.c ├── NwMmeUe.h ├── NwMmeUeLog.h ├── NwMmeUlp.c └── NwMmeUlp.h ├── nw-sae-gw ├── Makefile.am ├── Makefile.in ├── NwSaeGwDpe.c ├── NwSaeGwDpe.h ├── NwSaeGwLog.h ├── NwSaeGwMain.c ├── NwSaeGwUe.c ├── NwSaeGwUe.h ├── NwSaeGwUeFsm.c ├── NwSaeGwUeFsm.h ├── NwSaeGwUeLog.h ├── NwSaeGwUeState.c ├── NwSaeGwUeState.h ├── NwSaeGwUeStateAwaitPgwCreateSessionRsp.c ├── NwSaeGwUeStateAwaitPgwCreateSessionRsp.h ├── NwSaeGwUeStateAwaitPgwDeleteSessionRsp.c ├── NwSaeGwUeStateAwaitPgwDeleteSessionRsp.h ├── NwSaeGwUeStateAwaitPgwModifyBearerRsp.c ├── NwSaeGwUeStateAwaitPgwModifyBearerRsp.h ├── NwSaeGwUeStateAwaitPgwModifyBearerRsp2.c ├── NwSaeGwUeStateAwaitPgwModifyBearerRsp2.h ├── NwSaeGwUeStateInit.c ├── NwSaeGwUeStateInit.h ├── NwSaeGwUeStatePgwSessionCreated.c ├── NwSaeGwUeStatePgwSessionCreated.h ├── NwSaeGwUeStateSaeSessionCreated.c ├── NwSaeGwUeStateSaeSessionCreated.h ├── NwSaeGwUeStateSaeSessionEstablished.c ├── NwSaeGwUeStateSaeSessionEstablished.h ├── NwSaeGwUeStateSgwSessionCreated.c ├── NwSaeGwUeStateSgwSessionCreated.h ├── NwSaeGwUeStateSgwSessionEstablished.c ├── NwSaeGwUeStateSgwSessionEstablished.h ├── NwSaeGwUlp.c └── NwSaeGwUlp.h ├── nw-sdp ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── depcomp ├── include │ ├── NwSdpFlowContext.h │ ├── NwSdpLog.h │ ├── NwSdpPrivate.h │ ├── queue.h │ └── tree.h ├── install-sh ├── missing ├── shared │ ├── NwLog.h │ ├── NwSdp.h │ ├── NwSdpError.h │ └── NwUtils.h ├── src │ ├── Makefile.am │ ├── Makefile.in │ ├── NwSdp.c │ └── NwSdpFlowContext.c └── test-app │ ├── Makefile.am │ ├── Makefile.in │ └── nw-helloworld │ ├── Makefile.am │ ├── Makefile.in │ ├── NwMiniLogMgrEntity.c │ ├── NwMiniLogMgrEntity.h │ ├── NwMiniTmrMgrEntity.c │ ├── NwMiniTmrMgrEntity.h │ ├── NwMiniUdpEntity.c │ ├── NwMiniUdpEntity.h │ ├── NwMiniUlpEntity.c │ ├── NwMiniUlpEntity.h │ └── helloworld.c └── utils ├── nw-gtpu-if ├── NwGtpv1uIf.c ├── NwGtpv1uIf.h └── NwGtpv1uIfLog.h ├── nw-gtpv2c-if ├── NwGtpv2cIf.c ├── NwGtpv2cIf.h └── NwGtpv2cIfLog.h ├── nw-ippool ├── NwIpv4PoolMgr.c ├── NwIpv4PoolMgr.h └── NwIpv4PoolMgrLog.h ├── nw-ipv4-if ├── NwIpv4If.c ├── NwIpv4If.h └── NwIpv4IfLog.h ├── nw-log ├── NwLogMgr.c └── NwLogMgr.h ├── nw-tmr ├── NwTmrMgr.c └── NwTmrMgr.h └── nw-udp ├── NwUdp.c ├── NwUdp.h └── NwUdpLog.h /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | *.o 3 | *.py(c|o) 4 | *.mod.c 5 | *.o.cmd 6 | *.o.d 7 | modules.order 8 | Module.symvers 9 | *.ko 10 | *.ko.cmd 11 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Amit Chawre 2 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2011 Amit Chawre 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/ChangeLog -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | :: Licence Information 2 | ================================================================================== 3 | 4 | Copyright (c) 2010-2011 Amit Chawre 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | 1. Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 3. The name of the author may not be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | ================================================================================== 32 | 33 | DISCLAIMER : THIS INFORMATION IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 34 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 35 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 36 | SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 37 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 38 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 39 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 40 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 41 | INFORMATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 | 43 | ================================================================================== 44 | 45 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: Makefile.am 2 | 3 | # the subdirectories of the project to go into 4 | SUBDIRS = \ 5 | nw-event\ 6 | nw-ipv4\ 7 | nw-gre\ 8 | nw-gtpv1u\ 9 | nw-gtpv2c\ 10 | nw-sdp\ 11 | nw-mme-emu\ 12 | nw-sae-gw 13 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/NEWS -------------------------------------------------------------------------------- /common/NwError.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * Copyright (c) 2010-2011 Amit Chawre * 4 | * All rights reserved. * 5 | * * 6 | * Redistribution and use in source and binary forms, with or without * 7 | * modification, are permitted provided that the following conditions * 8 | * are met: * 9 | * * 10 | * 1. Redistributions of source code must retain the above copyright * 11 | * notice, this list of conditions and the following disclaimer. * 12 | * 2. Redistributions in binary form must reproduce the above copyright * 13 | * notice, this list of conditions and the following disclaimer in the * 14 | * documentation and/or other materials provided with the distribution. * 15 | * 3. The name of the author may not be used to endorse or promote products * 16 | * derived from this software without specific prior written permission. * 17 | * * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 28 | *----------------------------------------------------------------------------*/ 29 | 30 | 31 | #ifndef __NW_ERROR_H__ 32 | #define __NW_ERROR_H__ 33 | 34 | /** 35 | * @file NwError.h 36 | * @brief This header file contains return error code type definitions. 37 | */ 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | typedef enum { 44 | 45 | NW_OK = 0x00000000, 46 | NW_GTPV2C_MANDATORY_IE_DUPLICATE, 47 | NW_GTPV2C_CONDITIONAL_IE_MISSING, 48 | NW_GTPV2C_MANDATORY_IE_MISSING, 49 | NW_GTPV2C_MSG_MALFORMED, 50 | NW_FAILURE = 0xFFFFFFFE 51 | } NwRcT; 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif /* __NW_ERROR_CODE_H__ */ 58 | 59 | 60 | -------------------------------------------------------------------------------- /common/NwMem.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * Copyright (c) 2010-2011 Amit Chawre * 4 | * All rights reserved. * 5 | * * 6 | * Redistribution and use in source and binary forms, with or without * 7 | * modification, are permitted provided that the following conditions * 8 | * are met: * 9 | * * 10 | * 1. Redistributions of source code must retain the above copyright * 11 | * notice, this list of conditions and the following disclaimer. * 12 | * 2. Redistributions in binary form must reproduce the above copyright * 13 | * notice, this list of conditions and the following disclaimer in the * 14 | * documentation and/or other materials provided with the distribution. * 15 | * 3. The name of the author may not be used to endorse or promote products * 16 | * derived from this software without specific prior written permission. * 17 | * * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 28 | *----------------------------------------------------------------------------*/ 29 | 30 | #ifndef __NW_MEM_H__ 31 | #define __NW_MEM_H__ 32 | 33 | #include "NwTypes.h" 34 | #include "NwError.h" 35 | 36 | /** 37 | * @file NwMem.h 38 | * @brief This header file contains memory related operations definitions. 39 | */ 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | #define nwMemNew(_size) _nwMemNew(_size, __FILE__, __LINE__) 46 | #define nwMemDelete(_mem) _nwMemDelete(_mem, __FILE__, __LINE__) 47 | 48 | extern NwRcT 49 | nwMemInitialize(); 50 | 51 | extern NwRcT 52 | nwMemFinalize(); 53 | 54 | extern void* 55 | _nwMemNew(NwU32T size, NwCharT* fn, NwU32T ln); 56 | 57 | extern void 58 | _nwMemDelete(void* hMem, NwCharT* fn, NwU32T ln); 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | #endif /* __NW_MEM_H__ */ 65 | 66 | 67 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | # this is example-file: configure.ac 2 | 3 | # initial information about the project 4 | AC_INIT([NwEpc],[0.16],[beta]) 5 | 6 | # check if the source folder is correct 7 | AC_CONFIG_SRCDIR([nw-mme-emu/NwMmeMain.c]) 8 | AC_CONFIG_SRCDIR([nw-sae-gw/NwSaeGwMain.c]) 9 | 10 | # Checks for programs 11 | 12 | # check for C++ preprocessor and compiler and the library compiler 13 | AC_PROG_CXXCPP 14 | AC_PROG_CXX 15 | AC_PROG_RANLIB 16 | 17 | # automake initialisation and check for minimal automake API version 1.9 18 | AM_INIT_AUTOMAKE([1.9]) 19 | 20 | # use the C compiler for the following checks 21 | AC_LANG([C]) 22 | 23 | # Checks for header files. 24 | AC_HEADER_STDC 25 | AC_CHECK_HEADERS([string]) 26 | AC_CHECK_HEADERS([iostream]) 27 | 28 | # Checks for typedefs, structures, and compiler characteristics. 29 | AC_TYPE_SIZE_T 30 | 31 | # distribute additional compiler and linker flags 32 | # --> set these variables instead of CXXFLAGS or LDFLAGS 33 | AC_SUBST([AM_CFLAGS]) 34 | AC_SUBST([AM_LDFLAGS]) 35 | 36 | # files to generate via autotools (.am or .in source files) 37 | AC_CONFIG_FILES([Makefile]) 38 | AC_CONFIG_FILES([nw-event/Makefile]) 39 | AC_CONFIG_FILES([nw-event/src/Makefile]) 40 | AC_CONFIG_FILES([nw-event/test-app/Makefile]) 41 | AC_CONFIG_FILES([nw-ipv4/Makefile]) 42 | AC_CONFIG_FILES([nw-ipv4/src/Makefile]) 43 | AC_CONFIG_FILES([nw-ipv4/test-app/Makefile]) 44 | AC_CONFIG_FILES([nw-ipv4/test-app/nw-helloworld/Makefile]) 45 | AC_CONFIG_FILES([nw-gre/Makefile]) 46 | AC_CONFIG_FILES([nw-gre/src/Makefile]) 47 | AC_CONFIG_FILES([nw-gre/test-app/Makefile]) 48 | AC_CONFIG_FILES([nw-gre/test-app/nw-helloworld/Makefile]) 49 | AC_CONFIG_FILES([nw-gtpv1u/Makefile]) 50 | AC_CONFIG_FILES([nw-gtpv1u/src/Makefile]) 51 | AC_CONFIG_FILES([nw-gtpv1u/test-app/Makefile]) 52 | AC_CONFIG_FILES([nw-gtpv1u/test-app/nw-helloworld/Makefile]) 53 | AC_CONFIG_FILES([nw-gtpv2c/Makefile]) 54 | AC_CONFIG_FILES([nw-gtpv2c/src/Makefile]) 55 | AC_CONFIG_FILES([nw-gtpv2c/test-app/Makefile]) 56 | AC_CONFIG_FILES([nw-gtpv2c/test-app/nw-helloworld/Makefile]) 57 | AC_CONFIG_FILES([nw-gtpv2c/test-app/nw-egtping/Makefile]) 58 | AC_CONFIG_FILES([nw-sdp/Makefile]) 59 | AC_CONFIG_FILES([nw-sdp/src/Makefile]) 60 | AC_CONFIG_FILES([nw-sdp/test-app/Makefile]) 61 | AC_CONFIG_FILES([nw-sdp/test-app/nw-helloworld/Makefile]) 62 | AC_CONFIG_FILES([nw-mme-emu/Makefile]) 63 | AC_CONFIG_FILES([nw-sae-gw/Makefile]) 64 | 65 | # generate the final Makefile etc. 66 | AC_OUTPUT 67 | -------------------------------------------------------------------------------- /nw-event/AUTHORS: -------------------------------------------------------------------------------- 1 | Amit Chawre 2 | -------------------------------------------------------------------------------- /nw-event/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2011 Amit Chawre 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | -------------------------------------------------------------------------------- /nw-event/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-event/ChangeLog -------------------------------------------------------------------------------- /nw-event/Makefile.am: -------------------------------------------------------------------------------- 1 | # the subdirectories of the project to go into 2 | SUBDIRS = \ 3 | src\ 4 | test-app 5 | -------------------------------------------------------------------------------- /nw-event/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-event/NEWS -------------------------------------------------------------------------------- /nw-event/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-event/README -------------------------------------------------------------------------------- /nw-event/src/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = -I$(top_srcdir)/src -I../shared -I../include -Wall @AM_CFLAGS@ 2 | 3 | # The library name to build (note we are building static libs only) 4 | lib_LIBRARIES = libNwEvent.a 5 | 6 | # Where to install the headers on the system 7 | libNwEvent_adir = $(includedir)/NwEvent 8 | 9 | # The headers 10 | libNwEvent_a_HEADERS = \ 11 | ../include/queue.h\ 12 | ../include/NwEvent.h 13 | 14 | # The sources 15 | libNwEvent_a_SOURCES = \ 16 | $(libNwEvent_a_HEADERS) \ 17 | NwEvent.c 18 | 19 | 20 | -------------------------------------------------------------------------------- /nw-event/test-app/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign no-dependencies 2 | 3 | LDADD = ../src/libNwEvent.a 4 | AM_CFLAGS = -I../include 5 | 6 | noinst_PROGRAMS = event-test time-test 7 | 8 | event_test_sources = event-test.c 9 | time_test_sources = time-test.c 10 | 11 | verify: 12 | 13 | DISTCLEANFILES = *~ 14 | 15 | -------------------------------------------------------------------------------- /nw-event/test-app/event-test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Compile with: 3 | * cc event-test.c ../src/libNwEvent.a -I ../include/ -o event-test 4 | */ 5 | 6 | #ifdef HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include "NwEvent.h" 22 | 23 | typedef struct 24 | { 25 | NwEventT evfifo; 26 | int socket; 27 | } EventInfoT; 28 | 29 | static void 30 | fifo_read(void *arg) 31 | { 32 | char buf[255]; 33 | int len; 34 | EventInfoT *eventInfo = arg; 35 | 36 | fprintf(stderr, "fifo_read called with fd: %d, event: %d, arg: %p\n", 37 | eventInfo->socket, eventInfo->evfifo, arg); 38 | 39 | len = read(eventInfo->socket, buf, sizeof(buf) - 1); 40 | 41 | if (len == -1) { 42 | perror("read"); 43 | return; 44 | } else if (len == 0) { 45 | fprintf(stderr, "Connection closed\n"); 46 | return; 47 | } 48 | 49 | buf[len] = '\0'; 50 | fprintf(stdout, "Read: %s\n", buf); 51 | /* No need reschedule this event. All events are persitent by default. */ 52 | } 53 | 54 | int 55 | main (int argc, char **argv) 56 | { 57 | EventInfoT eventInfo; 58 | struct stat st; 59 | const char *fifo = "event.fifo"; 60 | 61 | if (lstat (fifo, &st) == 0) { 62 | if ((st.st_mode & S_IFMT) == S_IFREG) { 63 | errno = EEXIST; 64 | perror("lstat"); 65 | exit (1); 66 | } 67 | } 68 | 69 | unlink (fifo); 70 | if (mkfifo (fifo, 0600) == -1) { 71 | perror("mkfifo"); 72 | exit (1); 73 | } 74 | 75 | /* Linux pipes are broken, we need O_RDWR instead of O_RDONLY */ 76 | #ifdef __linux 77 | eventInfo.socket = open (fifo, O_RDWR | O_NONBLOCK, 0); 78 | #else 79 | eventInfo.socket = open (fifo, O_RDONLY | O_NONBLOCK, 0); 80 | #endif 81 | 82 | if (eventInfo.socket == -1) { 83 | perror("open"); 84 | exit (1); 85 | } 86 | 87 | fprintf(stderr, "Write data to %s\n", fifo); 88 | /* Initalize the event library */ 89 | nwEventInitialize(); 90 | 91 | /* Initalize one event */ 92 | nwEventAdd(&eventInfo.evfifo, eventInfo.socket, fifo_read, &eventInfo, NW_EVENT_READ); 93 | 94 | nwEventLoop(); 95 | 96 | return (0); 97 | } 98 | 99 | -------------------------------------------------------------------------------- /nw-event/test-app/time-test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Compile with: 3 | * cc time-test.c ../src/libNwEvent.a -I ../include/ -o time-test 4 | */ 5 | 6 | #include 7 | 8 | #ifdef HAVE_CONFIG_H 9 | #include "config.h" 10 | #endif 11 | 12 | #include 13 | #ifndef WIN32 14 | #include 15 | #include 16 | #endif 17 | #include 18 | #ifdef HAVE_SYS_TIME_H 19 | #include 20 | #endif 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include "NwEvent.h" 28 | 29 | int lasttime; 30 | 31 | static void 32 | timeout_cb(void *arg) 33 | { 34 | struct timeval tv; 35 | NwEventT *timeout = arg; 36 | int newtime = time(NULL); 37 | 38 | printf("%s: called at %d: %d\n", __func__, newtime, 39 | newtime - lasttime); 40 | lasttime = newtime; 41 | 42 | } 43 | 44 | int 45 | main (int argc, char **argv) 46 | { 47 | NwEventRcT rc; 48 | NwEventT *timeout; 49 | 50 | /* Initalize the event library */ 51 | nwEventInitialize(); 52 | 53 | /* Create and start one timer event */ 54 | rc = nwEventTimerCreateAndStart(&timeout, timeout_cb, &timeout, 2, 0, NW_EVENT_TIMER_REPETITIVE); 55 | 56 | nwEventLoop(); 57 | 58 | return (0); 59 | } 60 | 61 | -------------------------------------------------------------------------------- /nw-gre/AUTHORS: -------------------------------------------------------------------------------- 1 | Amit Chawre 2 | -------------------------------------------------------------------------------- /nw-gre/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2011 Amit Chawre 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | -------------------------------------------------------------------------------- /nw-gre/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-gre/ChangeLog -------------------------------------------------------------------------------- /nw-gre/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: Makefile.am 2 | 3 | # the subdirectories of the project to go into 4 | SUBDIRS = \ 5 | src\ 6 | test-app 7 | -------------------------------------------------------------------------------- /nw-gre/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-gre/NEWS -------------------------------------------------------------------------------- /nw-gre/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-gre/README -------------------------------------------------------------------------------- /nw-gre/include/NwGreTrxn.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - g t p v 2 u * 4 | * G e n e r i c R o u t i n g E n c a p s u l a t i o n S t a c k * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | /** 35 | * @file NwGreTrxn.h 36 | * @author Amit Chawre 37 | * @brief 38 | * 39 | * This header file contains required definitions and functions 40 | * prototypes used by gre transactions. 41 | * 42 | **/ 43 | 44 | 45 | #ifndef __NW_GRE_TRXN_H__ 46 | #define __NW_GRE_TRXN_H__ 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | NwRcT 53 | nwGreTrxnNew( NW_IN NwGreStackT* thiz, 54 | NW_OUT NwGreTrxnT **ppTrxn); 55 | 56 | 57 | NwRcT 58 | nwGreTrxnWithSeqNew( NW_IN NwGreStackT* thiz, 59 | NW_IN NwU32T seqNum, 60 | NW_OUT NwGreTrxnT **ppTrxn); 61 | 62 | NwRcT 63 | nwGreTrxnDelete( NW_INOUT NwGreTrxnT **ppTrxn); 64 | 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif /* __NW_GRE_TRXN_H__ */ 71 | 72 | /*--------------------------------------------------------------------------* 73 | * E N D O F F I L E * 74 | *--------------------------------------------------------------------------*/ 75 | 76 | -------------------------------------------------------------------------------- /nw-gre/shared/NwGreError.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - g t p v 2 u * 4 | * G e n e r i c R o u t i n g E n c a p s u l a t i o n S t a c k * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | 35 | #ifndef __NW_GRE_ERROR_H__ 36 | #define __NW_GRE_ERROR_H__ 37 | 38 | /** 39 | * @file NwGreError.h 40 | * @brief This header file contains return error code type definitions. 41 | */ 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | typedef enum { 48 | 49 | NW_OK = 0x00000000, 50 | NW_GRE_MANDATORY_IE_MISSING, 51 | 52 | NW_FAILURE = 0xFFFFFFFE 53 | } NwRcT; 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif /* __NW_ERROR_CODE_H__ */ 60 | 61 | 62 | -------------------------------------------------------------------------------- /nw-gre/shared/NwUtils.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - g t p v 2 u * 4 | * G e n e r i c R o u t i n g E n c a p s u l a t i o n S t a c k * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | #include 35 | 36 | #ifndef __NW_UTILS_H__ 37 | #define __NW_UTILS_H__ 38 | 39 | 40 | /** 41 | * @file NwUtils.h 42 | * @brief This header file contains utility macro and function definitions. 43 | */ 44 | 45 | #define NW_ASSERT assert /**< Assertion */ 46 | 47 | #define NW_CHK_NULL_PTR(_ptr) NW_ASSERT(_ptr != NULL) /**< Null pointer check */ 48 | 49 | #endif /* __NW_UTILS_H__ */ 50 | 51 | 52 | -------------------------------------------------------------------------------- /nw-gre/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: src/mylib/Makefile.am 2 | 3 | # additional include paths necessary to compile the C++ library 4 | AM_CFLAGS = -I$(top_srcdir)/src -I../shared -I../include @AM_CFLAGS@ 5 | 6 | ############################################################################### 7 | # THE LIBRARIES TO BUILD 8 | ############################################################################### 9 | 10 | # the library names to build (note we are building static libs only) 11 | lib_LIBRARIES = libNwGre.a 12 | 13 | # where to install the headers on the system 14 | libNwGre_adir = $(includedir)/mylib 15 | 16 | # the list of header files that belong to the library (to be installed later) 17 | libNwGre_a_HEADERS = \ 18 | ../shared/NwTypes.h\ 19 | ../shared/NwUtils.h\ 20 | ../shared/NwGreError.h\ 21 | ../shared/NwGre.h\ 22 | ../include/NwGrePrivate.h\ 23 | ../include/NwGreLog.h\ 24 | ../include/NwGreTrxn.h\ 25 | ../shared/NwGreIe.h\ 26 | ../shared/NwGreMsg.h\ 27 | ../include/NwGreTunnelEndPoint.h\ 28 | ../include/queue.h\ 29 | ../include/tree.h 30 | 31 | # the sources to add to the library and to add to the source distribution 32 | libNwGre_a_SOURCES = \ 33 | $(libNwGre_a_HEADERS) \ 34 | NwGreTunnelEndPoint.c\ 35 | NwGreTrxn.c\ 36 | NwGreMsg.c\ 37 | NwGre.c 38 | 39 | ############################################################################### 40 | 41 | 42 | -------------------------------------------------------------------------------- /nw-gre/test-app/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: Makefile.am 2 | 3 | # the subdirectories of the project to go into 4 | SUBDIRS = \ 5 | nw-helloworld 6 | -------------------------------------------------------------------------------- /nw-gre/test-app/nw-helloworld/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = helloworld 2 | 3 | AM_CFLAGS = -D__WITH_LIBEVENT__ -I../../shared -I../../include -I../../test-app/nw-udp -I../../test-app/nw-log -I../../../nw-event/include @AM_CFLAGS@ 4 | 5 | helloworld_SOURCES = \ 6 | NwEvt.h\ 7 | NwMiniLogMgrEntity.h\ 8 | NwMiniTmrMgrEntity.h\ 9 | NwMiniUlpEntity.h\ 10 | NwMiniUdpEntity.h\ 11 | NwMiniLogMgrEntity.c\ 12 | NwMiniTmrMgrEntity.c\ 13 | NwMiniUlpEntity.c\ 14 | NwMiniUdpEntity.c\ 15 | helloworld.c 16 | 17 | helloworld_LDADD = ../../src/libNwGre.a -levent $(AM_LDFLAGS) 18 | -------------------------------------------------------------------------------- /nw-gre/test-app/nw-helloworld/NwMiniLogMgrEntity.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C L O G M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file hello-world.c 11 | * @brief This file contains example of a minimalistic log manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwGre.h" 18 | 19 | #include "NwMiniLogMgrEntity.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | NwU32T g_log_level = NW_LOG_LEVEL_INFO; 26 | 27 | /*--------------------------------------------------------------------------- 28 | * Public functions 29 | *--------------------------------------------------------------------------*/ 30 | 31 | NwRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, NwU32T logLevel ) 32 | { 33 | thiz->logLevel = logLevel; 34 | return NW_OK; 35 | } 36 | 37 | NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel) 38 | { 39 | thiz->logLevel = logLevel; 40 | } 41 | 42 | NwRcT nwMiniLogMgrLogRequest (NwGreLogMgrHandleT hLogMgr, 43 | NwU32T logLevel, 44 | NwCharT* file, 45 | NwU32T line, 46 | NwCharT* logStr) 47 | { 48 | NwMiniLogMgrT* thiz = (NwMiniLogMgrT*) hLogMgr; 49 | if(thiz->logLevel >= logLevel) 50 | printf("NWGREU-STK %s - %s <%s,%u>\n", greLogLevelStr[logLevel], logStr, basename(file), line); 51 | return NW_OK; 52 | } 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /nw-gre/test-app/nw-helloworld/NwMiniLogMgrEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C L O G M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file hello-world.c 11 | * @brief This file contains example of a minimalistic log manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | 18 | #ifndef NW_ASSERT 19 | #define NW_ASSERT assert 20 | #endif 21 | 22 | #ifndef __NW_MINI_LOG_MGR_H__ 23 | #define __NW_MINI_LOG_MGR_H__ 24 | 25 | extern NwU32T g_log_level; 26 | 27 | 28 | #define NW_LOG( _logLevel, ...) \ 29 | do { \ 30 | if(g_log_level >= _logLevel) \ 31 | { \ 32 | char _logStr[1024]; \ 33 | snprintf(_logStr, 1024, __VA_ARGS__); \ 34 | printf("NWGREU-APP %s - %s <%s,%u>\n", greLogLevelStr[_logLevel], _logStr, basename(__FILE__), __LINE__);\ 35 | } \ 36 | } while(0) 37 | 38 | typedef struct 39 | { 40 | NwU8T logLevel; 41 | } NwMiniLogMgrT; 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | NwRcT nwMiniLogMgrLogRequest (NwGreLogMgrHandleT logMgrHandle, 48 | NwU32T logLevel, 49 | NwCharT* file, 50 | NwU32T line, 51 | NwCharT* logStr); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /nw-gre/test-app/nw-helloworld/NwMiniTmrMgrEntity.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C T M R M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file NwMiniTmrMgrEntity.c 11 | * @brief This file ontains example of a minimalistic timer manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwGre.h" 18 | #include "NwMiniLogMgrEntity.h" 19 | #include "NwMiniTmrMgrEntity.h" 20 | 21 | #ifndef NW_ASSERT 22 | #define NW_ASSERT assert 23 | #endif 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /*--------------------------------------------------------------------------- 30 | * Private functions 31 | *--------------------------------------------------------------------------*/ 32 | 33 | static void 34 | NW_TMR_CALLBACK(nwMiniTmrMgrHandleTimeout) 35 | { 36 | NwRcT rc; 37 | #ifdef __WITH_LIBEVENT__ 38 | NwMiniTmrMgrEntityT *pTmr = (NwMiniTmrMgrEntityT*) arg; 39 | 40 | /*--------------------------------------------------------------------------- 41 | * Send Timeout Request to GRE Stack Instance 42 | *--------------------------------------------------------------------------*/ 43 | 44 | rc = nwGreProcessTimeout(pTmr->timeoutArg); 45 | NW_ASSERT( NW_OK == rc ); 46 | 47 | free(pTmr); 48 | 49 | #else 50 | #warning "Timer library not defined!" 51 | #endif 52 | 53 | return; 54 | } 55 | 56 | /*--------------------------------------------------------------------------- 57 | * Public functions 58 | *--------------------------------------------------------------------------*/ 59 | 60 | NwRcT nwTimerStart( NwGreTimerMgrHandleT tmrMgrHandle, 61 | NwU32T timeoutSec, 62 | NwU32T timeoutUsec, 63 | NwU32T tmrType, 64 | void* timeoutArg, 65 | NwGreTimerHandleT* hTmr) 66 | { 67 | NwRcT rc = NW_OK; 68 | #ifdef __WITH_LIBEVENT__ 69 | NwMiniTmrMgrEntityT *pTmr; 70 | struct timeval tv; 71 | 72 | pTmr = (NwMiniTmrMgrEntityT*) malloc (sizeof(NwMiniTmrMgrEntityT)); 73 | 74 | /* set the timevalues*/ 75 | timerclear(&tv); 76 | tv.tv_sec = timeoutSec; 77 | tv.tv_usec = timeoutUsec; 78 | 79 | pTmr->timeoutArg = timeoutArg; 80 | evtimer_set(&pTmr->ev, nwMiniTmrMgrHandleTimeout, pTmr); 81 | 82 | /*add event*/ 83 | 84 | event_add(&(pTmr->ev), &tv); 85 | #else 86 | #warning "Timer library not defined!" 87 | #endif 88 | 89 | *hTmr = (NwGreTimerHandleT)pTmr; 90 | 91 | return NW_OK; 92 | } 93 | 94 | NwRcT nwTimerStop( NwGreTimerMgrHandleT tmrMgrHandle, 95 | NwGreTimerHandleT hTmr) 96 | { 97 | #ifdef __WITH_LIBEVENT__ 98 | evtimer_del(&(((NwMiniTmrMgrEntityT*)hTmr)->ev)); 99 | free((void*)hTmr); 100 | #else 101 | #warning "Timer library not defined!" 102 | #endif 103 | return NW_OK; 104 | } 105 | 106 | #ifdef __cplusplus 107 | } 108 | #endif 109 | -------------------------------------------------------------------------------- /nw-gre/test-app/nw-helloworld/NwMiniTmrMgrEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C T M R M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | 10 | /** 11 | * @file NwMiniTmrMgrEntity.c 12 | * @brief This file ontains example of a minimalistic timer manager entity. 13 | */ 14 | 15 | #include 16 | #include 17 | #include "NwEvt.h" 18 | 19 | #ifndef NW_ASSERT 20 | #define NW_ASSERT assert 21 | #endif 22 | 23 | #ifndef __NW_MINI_TMR_MGR_H__ 24 | #define __NW_MINI_TMR_MGR_H__ 25 | 26 | typedef struct 27 | { 28 | NwEventT ev; 29 | void* timeoutArg; 30 | } NwMiniTmrMgrEntityT; 31 | 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | NwRcT nwTimerStart( NwGreTimerMgrHandleT tmrMgrHandle, 38 | NwU32T timeoutSec, 39 | NwU32T timeoutUsec, 40 | NwU32T tmrType, 41 | void* timeoutArg, 42 | NwGreTimerHandleT* hTmr); 43 | 44 | 45 | NwRcT nwTimerStop( NwGreTimerMgrHandleT tmrMgrHandle, 46 | NwGreTimerHandleT hTmr); 47 | 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /nw-gre/test-app/nw-helloworld/NwMiniUdpEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C U D P E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | 10 | /** 11 | * @file NwMiniUdpEntity.h 12 | * @brief This file contains example of a minimalistic ULP entity. 13 | */ 14 | 15 | #include 16 | #include 17 | #include "NwEvt.h" 18 | 19 | #ifndef NW_ASSERT 20 | #define NW_ASSERT assert 21 | #endif 22 | 23 | #ifndef __NW_MINI_UDP_ENTITY_H__ 24 | #define __NW_MINI_UDP_ENTITY_H__ 25 | 26 | typedef struct 27 | { 28 | NwU32T hSocket; 29 | NwEventT ev; 30 | NwGreStackHandleT hGreStack; 31 | } NwMiniUdpEntityT; 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | NwRcT nwMiniUdpInit(NwMiniUdpEntityT* thiz, NwGreStackHandleT hGreStack, NwU8T* ipAddr); 38 | 39 | NwRcT nwMiniUdpDestroy(NwMiniUdpEntityT* thiz); 40 | 41 | NwRcT nwMiniUdpDataReq(NwGreUdpHandleT udpHandle, 42 | NwU8T* dataBuf, 43 | NwU32T dataSize, 44 | NwU32T peerAddr, 45 | NwU32T peerPort); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /nw-gre/test-app/nw-helloworld/NwMiniUlpEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C U L P E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file NwMiniUlpEntity.h 11 | * @brief This file contains example of a minimalistic ULP entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #ifndef __NW_MINI_ULP_H__ 18 | #define __NW_MINI_ULP_H__ 19 | 20 | typedef struct 21 | { 22 | int hSocket; 23 | NwU16T seqNum; 24 | NwU8T restartCounter; 25 | NwU8T localIpStr[16]; 26 | NwU8T peerIpStr[16]; 27 | NwU32T localPort[1025]; 28 | NwEventT ev[1025]; 29 | NwGreStackHandleT hGreStack; 30 | NwGreStackSessionHandleT hGreConn; 31 | } NwMiniUlpEntityT; 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | NwRcT 38 | nwMiniUlpInit(NwMiniUlpEntityT* thiz, NwGreStackHandleT hGreStack); 39 | 40 | NwRcT 41 | nwMiniUlpDestroy(NwMiniUlpEntityT* thiz); 42 | 43 | NwRcT 44 | nwMiniUlpCreateConn(NwMiniUlpEntityT* thiz, char* localIpStr, NwU16T localPort, char* peerIpStr); 45 | 46 | NwRcT 47 | nwMiniUlpDestroyConn(NwMiniUlpEntityT* thiz); 48 | 49 | NwRcT 50 | nwMiniUlpSendMsg(NwMiniUlpEntityT* thiz); 51 | 52 | NwRcT 53 | nwMiniUlpTpduSend(NwMiniUlpEntityT* thiz, NwU8T* tpduBuf, NwU32T tpduLen , NwU16T fromPort); 54 | 55 | NwRcT 56 | nwMiniUlpProcessStackReqCallback (NwGreUlpHandleT hUlp, 57 | NwGreUlpApiT *pUlpApi); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /nw-gtpv1u/AUTHORS: -------------------------------------------------------------------------------- 1 | Amit Chawre 2 | -------------------------------------------------------------------------------- /nw-gtpv1u/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2011 Amit Chawre 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | -------------------------------------------------------------------------------- /nw-gtpv1u/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-gtpv1u/ChangeLog -------------------------------------------------------------------------------- /nw-gtpv1u/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: Makefile.am 2 | 3 | # the subdirectories of the project to go into 4 | SUBDIRS = \ 5 | src\ 6 | test-app 7 | -------------------------------------------------------------------------------- /nw-gtpv1u/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-gtpv1u/NEWS -------------------------------------------------------------------------------- /nw-gtpv1u/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-gtpv1u/README -------------------------------------------------------------------------------- /nw-gtpv1u/include/NwGtpv1uTrxn.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - g t p v 2 u * 4 | * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | /** 35 | * @file NwGtpv1uTrxn.h 36 | * @author Amit Chawre 37 | * @brief 38 | * 39 | * This header file contains required definitions and functions 40 | * prototypes used by gtpv1u transactions. 41 | * 42 | **/ 43 | 44 | 45 | #ifndef __NW_GTPV1U_TRXN_H__ 46 | #define __NW_GTPV1U_TRXN_H__ 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | NwGtpv1uRcT 53 | nwGtpv1uTrxnNew( NW_IN NwGtpv1uStackT* thiz, 54 | NW_OUT NwGtpv1uTrxnT **ppTrxn); 55 | 56 | 57 | NwGtpv1uRcT 58 | nwGtpv1uTrxnWithSeqNew( NW_IN NwGtpv1uStackT* thiz, 59 | NW_IN NwU32T seqNum, 60 | NW_OUT NwGtpv1uTrxnT **ppTrxn); 61 | 62 | NwGtpv1uRcT 63 | nwGtpv1uTrxnDelete( NW_INOUT NwGtpv1uTrxnT **ppTrxn); 64 | 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif /* __NW_GTPV1U_TRXN_H__ */ 71 | 72 | /*--------------------------------------------------------------------------* 73 | * E N D O F F I L E * 74 | *--------------------------------------------------------------------------*/ 75 | 76 | -------------------------------------------------------------------------------- /nw-gtpv1u/shared/NwGtpv1uError.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - g t p v 2 c * 4 | * G P R S T u n n e l i n g P r o t o c o l v 2 c S t a c k * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | 35 | #ifndef __NW_GTPV1U_ERROR_H__ 36 | #define __NW_GTPV1U_ERROR_H__ 37 | 38 | /** 39 | * @file NwGtpv1uError.h 40 | * @brief This header file contains return error code type definitions. 41 | */ 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | typedef enum { 48 | 49 | NW_GTPV1U_OK = 0x00000000, 50 | NW_GTPV1U_MANDATORY_IE_DUPLICATE, 51 | NW_GTPV1U_MANDATORY_IE_MISSING, 52 | NW_GTPV1U_MSG_MALFORMED, 53 | NW_GTPV1U_FAILURE = 0xFFFFFFFE 54 | } NwGtpv1uRcT; 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif /* __NW_GTPV1U_ERROR_H__*/ 61 | 62 | 63 | -------------------------------------------------------------------------------- /nw-gtpv1u/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: src/mylib/Makefile.am 2 | 3 | # additional include paths necessary to compile the C++ library 4 | AM_CFLAGS = -I$(top_srcdir)/src -I../shared -I../include @AM_CFLAGS@ 5 | 6 | ############################################################################### 7 | # THE LIBRARIES TO BUILD 8 | ############################################################################### 9 | 10 | # the library names to build (note we are building static libs only) 11 | lib_LIBRARIES = libNwGtpv1u.a 12 | 13 | # where to install the headers on the system 14 | libNwGtpv1u_adir = $(includedir)/mylib 15 | 16 | # the list of header files that belong to the library (to be installed later) 17 | libNwGtpv1u_a_HEADERS = \ 18 | ../shared/NwTypes.h\ 19 | ../shared/NwUtils.h\ 20 | ../shared/NwGtpv1uError.h\ 21 | ../shared/NwLog.h\ 22 | ../shared/NwGtpv1u.h\ 23 | ../include/NwGtpv1uPrivate.h\ 24 | ../include/NwGtpv1uLog.h\ 25 | ../include/NwGtpv1uTrxn.h\ 26 | ../shared/NwGtpv1uIe.h\ 27 | ../shared/NwGtpv1uMsg.h\ 28 | ../include/NwGtpv1uTunnelEndPoint.h\ 29 | ../include/queue.h\ 30 | ../include/tree.h 31 | 32 | # the sources to add to the library and to add to the source distribution 33 | libNwGtpv1u_a_SOURCES = \ 34 | $(libNwGtpv1u_a_HEADERS) \ 35 | NwGtpv1uTunnelEndPoint.c\ 36 | NwGtpv1uTrxn.c\ 37 | NwGtpv1uMsg.c\ 38 | NwGtpv1u.c 39 | 40 | ############################################################################### 41 | 42 | 43 | -------------------------------------------------------------------------------- /nw-gtpv1u/test-app/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: Makefile.am 2 | 3 | # the subdirectories of the project to go into 4 | SUBDIRS = \ 5 | nw-helloworld 6 | -------------------------------------------------------------------------------- /nw-gtpv1u/test-app/nw-helloworld/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = helloworld 2 | 3 | AM_CFLAGS = -D__WITH_LIBEVENT__ -I../../shared -I../../include -I../../test-app/nw-udp -I../../test-app/nw-log @AM_CFLAGS@ 4 | 5 | helloworld_SOURCES = \ 6 | NwEvt.h\ 7 | NwMiniLogMgrEntity.h\ 8 | NwMiniTmrMgrEntity.h\ 9 | NwMiniUlpEntity.h\ 10 | NwMiniUdpEntity.h\ 11 | NwMiniLogMgrEntity.c\ 12 | NwMiniTmrMgrEntity.c\ 13 | NwMiniUlpEntity.c\ 14 | NwMiniUdpEntity.c\ 15 | helloworld.c 16 | 17 | helloworld_LDADD = ../../src/libNwGtpv1u.a -levent $(AM_LDFLAGS) 18 | -------------------------------------------------------------------------------- /nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C L O G M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file hello-world.c 11 | * @brief This file contains example of a minimalistic log manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwLog.h" 17 | #include "NwEvt.h" 18 | #include "NwGtpv1u.h" 19 | 20 | #include "NwMiniLogMgrEntity.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | NwU32T g_log_level = NW_LOG_LEVEL_INFO; 27 | 28 | /*--------------------------------------------------------------------------- 29 | * Public functions 30 | *--------------------------------------------------------------------------*/ 31 | 32 | NwGtpv1uRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, NwU32T logLevel ) 33 | { 34 | thiz->logLevel = logLevel; 35 | return NW_GTPV1U_OK; 36 | } 37 | 38 | NwGtpv1uRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel) 39 | { 40 | thiz->logLevel = logLevel; 41 | } 42 | 43 | NwGtpv1uRcT nwMiniLogMgrLogRequest (NwGtpv1uLogMgrHandleT hLogMgr, 44 | NwU32T logLevel, 45 | NwCharT* file, 46 | NwU32T line, 47 | NwCharT* logStr) 48 | { 49 | NwMiniLogMgrT* thiz = (NwMiniLogMgrT*) hLogMgr; 50 | if(thiz->logLevel >= logLevel) 51 | printf("NWGTPv2U-STK %s - %s <%s,%u>\n", gLogLevelStr[logLevel], logStr, basename(file), line); 52 | return NW_GTPV1U_OK; 53 | } 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C L O G M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file hello-world.c 11 | * @brief This file contains example of a minimalistic log manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwLog.h" 18 | 19 | #ifndef NW_ASSERT 20 | #define NW_ASSERT assert 21 | #endif 22 | 23 | #ifndef __NW_MINI_LOG_MGR_H__ 24 | #define __NW_MINI_LOG_MGR_H__ 25 | 26 | extern NwU32T g_log_level; 27 | 28 | 29 | #define NW_LOG( _logLevel, ...) \ 30 | do { \ 31 | if(g_log_level >= _logLevel) \ 32 | { \ 33 | char _logStr[1024]; \ 34 | snprintf(_logStr, 1024, __VA_ARGS__); \ 35 | printf("NWGTPv2U-APP %s - %s <%s,%u>\n", gLogLevelStr[_logLevel], _logStr, basename(__FILE__), __LINE__);\ 36 | } \ 37 | } while(0) 38 | 39 | typedef struct 40 | { 41 | NwU8T logLevel; 42 | } NwMiniLogMgrT; 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | NwGtpv1uRcT nwMiniLogMgrLogRequest (NwGtpv1uLogMgrHandleT logMgrHandle, 49 | NwU32T logLevel, 50 | NwCharT* file, 51 | NwU32T line, 52 | NwCharT* logStr); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C T M R M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file NwMiniTmrMgrEntity.c 11 | * @brief This file ontains example of a minimalistic timer manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwGtpv1u.h" 18 | #include "NwMiniLogMgrEntity.h" 19 | #include "NwMiniTmrMgrEntity.h" 20 | 21 | #ifndef NW_ASSERT 22 | #define NW_ASSERT assert 23 | #endif 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /*--------------------------------------------------------------------------- 30 | * Private functions 31 | *--------------------------------------------------------------------------*/ 32 | 33 | static void 34 | NW_TMR_CALLBACK(nwMiniTmrMgrHandleTimeout) 35 | { 36 | NwGtpv1uRcT rc; 37 | NwMiniTmrMgrEntityT *pTmr = (NwMiniTmrMgrEntityT*) arg; 38 | 39 | /*--------------------------------------------------------------------------- 40 | * Send Timeout Request to GTPv1u Stack Instance 41 | *--------------------------------------------------------------------------*/ 42 | 43 | rc = nwGtpv1uProcessTimeout(pTmr->timeoutArg); 44 | NW_ASSERT( rc == NW_GTPV1U_OK ); 45 | 46 | free(pTmr); 47 | 48 | return; 49 | } 50 | 51 | /*--------------------------------------------------------------------------- 52 | * Public functions 53 | *--------------------------------------------------------------------------*/ 54 | 55 | NwGtpv1uRcT nwTimerStart( NwGtpv1uTimerMgrHandleT tmrMgrHandle, 56 | NwU32T timeoutSec, 57 | NwU32T timeoutUsec, 58 | NwU32T tmrType, 59 | void* timeoutArg, 60 | NwGtpv1uTimerHandleT* hTmr) 61 | { 62 | NwGtpv1uRcT rc = NW_GTPV1U_OK; 63 | NwMiniTmrMgrEntityT *pTmr; 64 | struct timeval tv; 65 | 66 | NW_LOG(NW_LOG_LEVEL_INFO, "Received start timer request from stack with timer type %u, arg %x, for %u sec and %u usec", tmrType, timeoutArg, timeoutSec, timeoutUsec); 67 | 68 | pTmr = (NwMiniTmrMgrEntityT*) malloc (sizeof(NwMiniTmrMgrEntityT)); 69 | 70 | /* set the timevalues*/ 71 | timerclear(&tv); 72 | tv.tv_sec = timeoutSec; 73 | tv.tv_usec = timeoutUsec; 74 | 75 | pTmr->timeoutArg = timeoutArg; 76 | evtimer_set(&pTmr->ev, nwMiniTmrMgrHandleTimeout, pTmr); 77 | 78 | /*add event*/ 79 | 80 | event_add(&(pTmr->ev), &tv); 81 | 82 | *hTmr = (NwGtpv1uTimerHandleT)pTmr; 83 | 84 | return rc; 85 | } 86 | 87 | NwGtpv1uRcT nwTimerStop( NwGtpv1uTimerMgrHandleT tmrMgrHandle, 88 | NwGtpv1uTimerHandleT hTmr) 89 | { 90 | NW_LOG(NW_LOG_LEVEL_INFO, "Received stop timer request from stack for timer handle %u", hTmr); 91 | evtimer_del(&(((NwMiniTmrMgrEntityT*)hTmr)->ev)); 92 | free((void*)hTmr); 93 | return NW_GTPV1U_OK; 94 | } 95 | 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | -------------------------------------------------------------------------------- /nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C T M R M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | 10 | /** 11 | * @file NwMiniTmrMgrEntity.c 12 | * @brief This file ontains example of a minimalistic timer manager entity. 13 | */ 14 | 15 | #include 16 | #include 17 | #include "NwEvt.h" 18 | #include "NwLog.h" 19 | 20 | #ifndef NW_ASSERT 21 | #define NW_ASSERT assert 22 | #endif 23 | 24 | #ifndef __NW_MINI_TMR_MGR_H__ 25 | #define __NW_MINI_TMR_MGR_H__ 26 | 27 | typedef struct 28 | { 29 | NwEventT ev; 30 | void* timeoutArg; 31 | } NwMiniTmrMgrEntityT; 32 | 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | NwGtpv1uRcT nwTimerStart( NwGtpv1uTimerMgrHandleT tmrMgrHandle, 39 | NwU32T timeoutSec, 40 | NwU32T timeoutUsec, 41 | NwU32T tmrType, 42 | void* timeoutArg, 43 | NwGtpv1uTimerHandleT* hTmr); 44 | 45 | 46 | NwGtpv1uRcT nwTimerStop( NwGtpv1uTimerMgrHandleT tmrMgrHandle, 47 | NwGtpv1uTimerHandleT hTmr); 48 | 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C U D P E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | 10 | /** 11 | * @file NwMiniUdpEntity.h 12 | * @brief This file contains example of a minimalistic ULP entity. 13 | */ 14 | 15 | #include 16 | #include 17 | #include "NwEvt.h" 18 | #include "NwLog.h" 19 | 20 | #ifndef NW_ASSERT 21 | #define NW_ASSERT assert 22 | #endif 23 | 24 | #ifndef __NW_MINI_UDP_ENTITY_H__ 25 | #define __NW_MINI_UDP_ENTITY_H__ 26 | 27 | typedef struct 28 | { 29 | NwU32T hSocket; 30 | NwEventT ev; 31 | NwGtpv1uStackHandleT hGtpv1uStack; 32 | } NwMiniUdpEntityT; 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | NwGtpv1uRcT nwMiniUdpInit(NwMiniUdpEntityT* thiz, NwGtpv1uStackHandleT hGtpv1uStack, NwU8T* ipAddr); 39 | 40 | NwGtpv1uRcT nwMiniUdpDestroy(NwMiniUdpEntityT* thiz); 41 | 42 | NwGtpv1uRcT nwMiniUdpDataReq(NwGtpv1uUdpHandleT udpHandle, 43 | NwU8T* dataBuf, 44 | NwU32T dataSize, 45 | NwU32T peerAddr, 46 | NwU32T peerPort); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C U L P E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file NwMiniUlpEntity.h 11 | * @brief This file contains example of a minimalistic ULP entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwLog.h" 18 | 19 | #ifndef __NW_MINI_ULP_H__ 20 | #define __NW_MINI_ULP_H__ 21 | 22 | typedef struct 23 | { 24 | int hSocket; 25 | NwU16T seqNum; 26 | NwU8T restartCounter; 27 | NwU8T localIpStr[16]; 28 | NwU8T peerIpStr[16]; 29 | NwU32T localPort[1025]; 30 | NwEventT ev[1025]; 31 | NwGtpv1uStackHandleT hGtpv1uStack; 32 | NwGtpv1uStackSessionHandleT hGtpv1uConn; 33 | } NwMiniUlpEntityT; 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | NwGtpv1uRcT 40 | nwMiniUlpInit(NwMiniUlpEntityT* thiz, NwGtpv1uStackHandleT hGtpv1uStack); 41 | 42 | NwGtpv1uRcT 43 | nwMiniUlpDestroy(NwMiniUlpEntityT* thiz); 44 | 45 | NwGtpv1uRcT 46 | nwMiniUlpCreateConn(NwMiniUlpEntityT* thiz, char* localIpStr, NwU16T localPort, char* peerIpStr); 47 | 48 | NwGtpv1uRcT 49 | nwMiniUlpDestroyConn(NwMiniUlpEntityT* thiz); 50 | 51 | NwGtpv1uRcT 52 | nwMiniUlpSendMsg(NwMiniUlpEntityT* thiz); 53 | 54 | NwGtpv1uRcT 55 | nwMiniUlpTpduSend(NwMiniUlpEntityT* thiz, NwU8T* tpduBuf, NwU32T tpduLen , NwU16T fromPort); 56 | 57 | NwGtpv1uRcT 58 | nwMiniUlpProcessStackReqCallback (NwGtpv1uUlpHandleT hUlp, 59 | NwGtpv1uUlpApiT *pUlpApi); 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /nw-gtpv2c/AUTHORS: -------------------------------------------------------------------------------- 1 | Amit Chawre 2 | -------------------------------------------------------------------------------- /nw-gtpv2c/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2011 Amit Chawre 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | -------------------------------------------------------------------------------- /nw-gtpv2c/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-gtpv2c/ChangeLog -------------------------------------------------------------------------------- /nw-gtpv2c/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: Makefile.am 2 | 3 | # the subdirectories of the project to go into 4 | SUBDIRS = \ 5 | src\ 6 | test-app 7 | -------------------------------------------------------------------------------- /nw-gtpv2c/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-gtpv2c/NEWS -------------------------------------------------------------------------------- /nw-gtpv2c/shared/NwError.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - g t p v 2 c * 4 | * G P R S T u n n e l i n g P r o t o c o l v 2 c S t a c k * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | 35 | #ifndef __NW_ERROR_H__ 36 | #define __NW_ERROR_H__ 37 | 38 | /** 39 | * @file NwError.h 40 | * @brief This header file contains return error code type definitions. 41 | */ 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | typedef enum { 48 | 49 | NW_OK = 0x00000000, 50 | NW_GTPV2C_IE_MISSING, 51 | NW_GTPV2C_IE_INCORRECT, 52 | NW_GTPV2C_MANDATORY_IE_DUPLICATE, 53 | NW_GTPV2C_CONDITIONAL_IE_MISSING, 54 | NW_GTPV2C_MANDATORY_IE_MISSING, 55 | NW_GTPV2C_MSG_MALFORMED, 56 | NW_FAILURE = 0xFFFFFFFE 57 | } NwRcT; 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif /* __NW_ERROR_CODE_H__ */ 64 | 65 | 66 | -------------------------------------------------------------------------------- /nw-gtpv2c/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: src/mylib/Makefile.am 2 | 3 | # additional include paths necessary to compile the C++ library 4 | AM_CFLAGS = -Wall -I$(top_srcdir)/src -I../shared -I../include @AM_CFLAGS@ 5 | 6 | ############################################################################### 7 | # THE LIBRARIES TO BUILD 8 | ############################################################################### 9 | 10 | # the library names to build (note we are building static libs only) 11 | lib_LIBRARIES = libNwGtpv2c.a 12 | 13 | # where to install the headers on the system 14 | libNwGtpv2c_adir = $(includedir)/mylib 15 | 16 | # the list of header files that belong to the library (to be installed later) 17 | libNwGtpv2c_a_HEADERS = \ 18 | ../shared/NwTypes.h\ 19 | ../shared/NwUtils.h\ 20 | ../shared/NwError.h\ 21 | ../shared/NwLog.h\ 22 | ../shared/NwGtpv2c.h\ 23 | ../shared/NwGtpv2cMsg.h\ 24 | ../shared/NwGtpv2cMsgParser.h\ 25 | ../shared/NwGtpv2cIe.h\ 26 | ../include/NwGtpv2cPrivate.h\ 27 | ../include/NwGtpv2cTrxn.h\ 28 | ../include/NwGtpv2cTunnel.h\ 29 | ../include/NwGtpv2cMsgIeParseInfo.h\ 30 | ../include/NwGtpv2cLog.h\ 31 | ../include/queue.h\ 32 | ../include/tree.h 33 | 34 | # the sources to add to the library and to add to the source distribution 35 | libNwGtpv2c_a_SOURCES = \ 36 | $(libNwGtpv2_a_HEADERS) \ 37 | NwGtpv2cTrxn.c\ 38 | NwGtpv2cTunnel.c\ 39 | NwGtpv2cMsg.c\ 40 | NwGtpv2cMsgIeParseInfo.c\ 41 | NwGtpv2cMsgParser.c\ 42 | NwGtpv2c.c 43 | 44 | ############################################################################### 45 | 46 | 47 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: Makefile.am 2 | 3 | # the subdirectories of the project to go into 4 | SUBDIRS = \ 5 | nw-egtping\ 6 | nw-helloworld 7 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-egtping/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = egtping 2 | 3 | AM_CFLAGS = -D__WITH_LIBEVENT__ -I../../shared -I../../include -I../../test-app/nw-udp -I../../test-app/nw-log @AM_CFLAGS@ 4 | 5 | egtping_SOURCES = \ 6 | NwEvt.h\ 7 | NwMiniLogMgrEntity.h\ 8 | NwMiniTmrMgrEntity.h\ 9 | NwMiniUlpEntity.h\ 10 | NwMiniUdpEntity.h\ 11 | NwMiniLogMgrEntity.c\ 12 | NwMiniTmrMgrEntity.c\ 13 | NwMiniUlpEntity.c\ 14 | NwMiniUdpEntity.c\ 15 | NwEgtPingMain.c 16 | 17 | egtping_LDADD = ../../src/libNwGtpv2c.a -levent $(AM_LDFLAGS) 18 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-egtping/NwMiniLogMgrEntity.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C L O G M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file hello-world.c 11 | * @brief This file contains example of a minimalistic log manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwTypes.h" 18 | #include "NwError.h" 19 | #include "NwLog.h" 20 | #include "NwGtpv2c.h" 21 | 22 | #include "NwMiniLogMgrEntity.h" 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | static 29 | NwCharT* gLogLevelStr[] = {"EMER", "ALER", "CRIT", "ERRO", "WARN", "NOTI", "INFO", "DEBG"}; 30 | 31 | NwMiniLogMgrT __gLogMgr; 32 | 33 | 34 | /*--------------------------------------------------------------------------- 35 | * Public functions 36 | *--------------------------------------------------------------------------*/ 37 | 38 | NwMiniLogMgrT* nwMiniLogMgrGetInstance() 39 | { 40 | return &(__gLogMgr); 41 | } 42 | 43 | NwRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, NwU32T logLevel ) 44 | { 45 | thiz->logLevel = logLevel; 46 | return NW_OK; 47 | } 48 | 49 | NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel) 50 | { 51 | thiz->logLevel = logLevel; 52 | } 53 | 54 | NwRcT nwMiniLogMgrLogRequest (NwGtpv2cLogMgrHandleT hLogMgr, 55 | NwU32T logLevel, 56 | NwCharT* file, 57 | NwU32T line, 58 | NwCharT* logStr) 59 | { 60 | NwMiniLogMgrT* thiz = (NwMiniLogMgrT*) hLogMgr; 61 | if(thiz->logLevel >= logLevel) 62 | //printf("NWEGTPSTK %s - %s <%s,%u>\n", gLogLevelStr[logLevel], logStr, basename(file), line); 63 | return NW_OK; 64 | } 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-egtping/NwMiniLogMgrEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C L O G M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file hello-world.c 11 | * @brief This file contains example of a minimalistic log manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwLog.h" 18 | 19 | #ifndef NW_ASSERT 20 | #define NW_ASSERT assert 21 | #endif 22 | 23 | #ifndef __NW_MINI_LOG_MGR_H__ 24 | #define __NW_MINI_LOG_MGR_H__ 25 | 26 | #define NW_LOG( _logLevel, ...) \ 27 | do { \ 28 | if((nwMiniLogMgrGetInstance())->logLevel >= _logLevel) \ 29 | { \ 30 | char _logStr[1024]; \ 31 | snprintf(_logStr, 1024, __VA_ARGS__); \ 32 | printf("%s \n", _logStr);\ 33 | } \ 34 | } while(0) 35 | 36 | /** 37 | * MiniLogMgr Class Definition 38 | */ 39 | typedef struct NwMiniLogMgr 40 | { 41 | NwU8T logLevel; /*< Log level */ 42 | } NwMiniLogMgrT; 43 | 44 | 45 | /*--------------------------------------------------------------------------- 46 | * Public functions 47 | *--------------------------------------------------------------------------*/ 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /** 54 | * Get global singleton MiniLogMgr instance 55 | */ 56 | NwMiniLogMgrT* nwMiniLogMgrGetInstance(); 57 | 58 | /** 59 | * Initialize MiniLogMgr 60 | * @param thiz : Pointer to global singleton MiniLogMgr instance 61 | * @param logLevel : Log Level 62 | */ 63 | NwRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, NwU32T logLevel ); 64 | 65 | /** 66 | * Set MiniLogMgr log level 67 | * @param thiz : Pointer to global singleton MiniLogMgr instance 68 | * @param logLevel : Log Level 69 | */ 70 | NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel); 71 | 72 | /** 73 | * Process log request from stack 74 | * @param thiz : Pointer to global singleton MiniLogMgr instance 75 | * @param logLevel : Log Level 76 | * @param file : Filename 77 | * @param line : Line Number 78 | * @param logStr : Log string 79 | */ 80 | NwRcT nwMiniLogMgrLogRequest (NwGtpv2cLogMgrHandleT logMgrHandle, 81 | NwU32T logLevel, 82 | NwCharT* file, 83 | NwU32T line, 84 | NwCharT* logStr); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-egtping/NwMiniTmrMgrEntity.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C T M R M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file NwMiniTmrMgrEntity.c 11 | * @brief This file ontains example of a minimalistic timer manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwGtpv2c.h" 18 | #include "NwMiniLogMgrEntity.h" 19 | #include "NwMiniTmrMgrEntity.h" 20 | 21 | #ifndef NW_ASSERT 22 | #define NW_ASSERT assert 23 | #endif 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | static 30 | NwCharT* gLogLevelStr[] = {"EMER", "ALER", "CRIT", "ERRO", "WARN", "NOTI", "INFO", "DEBG"}; 31 | 32 | /*--------------------------------------------------------------------------- 33 | * Private functions 34 | *--------------------------------------------------------------------------*/ 35 | 36 | static void 37 | NW_TMR_CALLBACK(nwGtpv2cNodeHandleStackTimerTimeout) 38 | { 39 | NwRcT rc; 40 | NwGtpv2cNodeTmrT *pTmr = (NwGtpv2cNodeTmrT*) arg; 41 | 42 | /* 43 | * Send Timeout Request to Gtpv2c Stack Instance 44 | */ 45 | rc = nwGtpv2cProcessTimeout(pTmr->timeoutArg); 46 | NW_ASSERT(NW_OK == rc); 47 | 48 | free(pTmr); 49 | 50 | return; 51 | } 52 | 53 | /*--------------------------------------------------------------------------- 54 | * Public functions 55 | *--------------------------------------------------------------------------*/ 56 | 57 | NwRcT nwTimerStart( NwGtpv2cTimerMgrHandleT tmrMgrHandle, 58 | NwU32T timeoutSec, 59 | NwU32T timeoutUsec, 60 | NwU32T tmrType, 61 | void* timeoutArg, 62 | NwGtpv2cTimerHandleT* hTmr) 63 | { 64 | NwRcT rc = NW_OK; 65 | NwGtpv2cNodeTmrT *pTmr; 66 | struct timeval tv; 67 | 68 | pTmr = (NwGtpv2cNodeTmrT*) malloc(sizeof(NwGtpv2cNodeTmrT)); 69 | 70 | /* set the timevalues*/ 71 | timerclear(&tv); 72 | tv.tv_sec = timeoutSec; 73 | tv.tv_usec = timeoutUsec; 74 | 75 | pTmr->timeoutArg = timeoutArg; 76 | evtimer_set(&pTmr->ev, nwGtpv2cNodeHandleStackTimerTimeout, pTmr); 77 | 78 | /*add event*/ 79 | 80 | event_add(&(pTmr->ev), &tv); 81 | 82 | *hTmr = (NwGtpv2cTimerHandleT)pTmr; 83 | 84 | return rc; 85 | } 86 | 87 | NwRcT nwTimerStop( NwGtpv2cTimerMgrHandleT tmrMgrHandle, 88 | NwGtpv2cTimerHandleT hTmr) 89 | { 90 | evtimer_del(&(((NwGtpv2cNodeTmrT*)hTmr)->ev)); 91 | free((void*)hTmr); 92 | return NW_OK; 93 | } 94 | 95 | #ifdef __cplusplus 96 | } 97 | #endif 98 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-egtping/NwMiniTmrMgrEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C T M R M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | 10 | /** 11 | * @file NwMiniTmrMgrEntity.c 12 | * @brief This file ontains example of a minimalistic timer manager entity. 13 | */ 14 | 15 | #include 16 | #include 17 | #include "NwEvt.h" 18 | #include "NwLog.h" 19 | 20 | #ifndef NW_ASSERT 21 | #define NW_ASSERT assert 22 | #endif 23 | 24 | #ifndef __NW_MINI_TMR_MGR_H__ 25 | #define __NW_MINI_TMR_MGR_H__ 26 | 27 | typedef struct 28 | { 29 | NwU8T _tbd; 30 | } NwGtpv2cNodeTmrMgrT; 31 | 32 | typedef struct 33 | { 34 | NwEventT ev; 35 | void* timeoutArg; 36 | } NwGtpv2cNodeTmrT; 37 | 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | NwRcT nwTimerStart( NwGtpv2cTimerMgrHandleT tmrMgrHandle, 44 | NwU32T timeoutSec, 45 | NwU32T timeoutUsec, 46 | NwU32T tmrType, 47 | void* timeoutArg, 48 | NwGtpv2cTimerHandleT* hTmr); 49 | 50 | 51 | NwRcT nwTimerStop( NwGtpv2cTimerMgrHandleT tmrMgrHandle, 52 | NwGtpv2cTimerHandleT hTmr); 53 | 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-egtping/NwMiniUdpEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C U D P E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | 10 | /** 11 | * @file NwMiniUdpEntity.c 12 | * @brief This file contains example of a minimalistic ULP entity. 13 | */ 14 | 15 | #include 16 | #include 17 | #include "NwEvt.h" 18 | #include "NwLog.h" 19 | 20 | #ifndef NW_ASSERT 21 | #define NW_ASSERT assert 22 | #endif 23 | 24 | #ifndef __NW_MINI_UDP_ENTITY_H__ 25 | #define __NW_MINI_UDP_ENTITY_H__ 26 | 27 | typedef struct 28 | { 29 | NwU32T ipv4Addr; 30 | NwU32T hSocket; 31 | NwEventT ev; 32 | NwGtpv2cStackHandleT hGtpv2cStack; 33 | NwU32T packetsSent; 34 | NwU32T packetsRcvd; 35 | } NwGtpv2cNodeUdpT; 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | NwRcT nwGtpv2cUdpInit(NwGtpv2cNodeUdpT* thiz, NwGtpv2cStackHandleT hGtpv2cStack, NwU8T* ipAddrStr); 42 | 43 | NwRcT nwGtpv2cUdpDestroy(NwGtpv2cNodeUdpT* thiz); 44 | 45 | NwRcT nwGtpv2cUdpDataReq(NwGtpv2cUdpHandleT udpHandle, 46 | NwU8T* dataBuf, 47 | NwU32T dataSize, 48 | NwU32T peerIp, 49 | NwU32T peerPort); 50 | 51 | NwRcT nwGtpv2cUdpReset(NwGtpv2cNodeUdpT* thiz); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-egtping/NwMiniUlpEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C U L P E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file NwMiniUlpEntity.h 11 | * @brief This file contains example of a minimalistic ULP entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwLog.h" 18 | 19 | #ifndef __NW_MINI_ULP_H__ 20 | #define __NW_MINI_ULP_H__ 21 | 22 | typedef struct 23 | { 24 | NwU8T peerIpStr[16]; 25 | NwU32T restartCounter; 26 | NwGtpv2cStackHandleT hGtpv2cStack; 27 | } NwGtpv2cNodeUlpT; 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | NwRcT 34 | nwGtpv2cUlpInit(NwGtpv2cNodeUlpT* thiz, NwGtpv2cStackHandleT hGtpv2cStack, char* peerIpStr ); 35 | 36 | NwRcT 37 | nwGtpv2cUlpDestroy(NwGtpv2cNodeUlpT* thiz); 38 | 39 | NwRcT 40 | nwGtpv2cUlpProcessStackReqCallback (NwGtpv2cUlpHandleT hUlp, 41 | NwGtpv2cUlpApiT *pUlpApi); 42 | 43 | NwRcT 44 | nwGtpv2cUlpPing(NwGtpv2cNodeUlpT* thiz, 45 | NwU32T peerIp, 46 | NwU32T pingCount, 47 | NwU32T pingInterval, 48 | NwU32T t3Time, 49 | NwU32T n3Count); 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-helloworld/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = helloworld 2 | 3 | AM_CFLAGS = -D__WITH_LIBEVENT__ -I../../shared -I../../include -I../../test-app/nw-udp -I../../test-app/nw-log @AM_CFLAGS@ 4 | 5 | helloworld_SOURCES = \ 6 | NwEvt.h\ 7 | NwMiniLogMgrEntity.h\ 8 | NwMiniTmrMgrEntity.h\ 9 | NwMiniUlpEntity.h\ 10 | NwMiniUdpEntity.h\ 11 | NwMiniLogMgrEntity.c\ 12 | NwMiniTmrMgrEntity.c\ 13 | NwMiniUlpEntity.c\ 14 | NwMiniUdpEntity.c\ 15 | helloworld.c 16 | 17 | helloworld_LDADD = ../../src/libNwGtpv2c.a -levent $(AM_LDFLAGS) 18 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-helloworld/NwMiniLogMgrEntity.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C L O G M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file hello-world.c 11 | * @brief This file contains example of a minimalistic log manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwTypes.h" 18 | #include "NwError.h" 19 | #include "NwLog.h" 20 | #include "NwGtpv2c.h" 21 | 22 | #include "NwMiniLogMgrEntity.h" 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | static 29 | NwCharT* gLogLevelStr[] = {"EMER", "ALER", "CRIT", "ERRO", "WARN", "NOTI", "INFO", "DEBG"}; 30 | 31 | NwMiniLogMgrT __gLogMgr; 32 | 33 | 34 | /*--------------------------------------------------------------------------- 35 | * Public functions 36 | *--------------------------------------------------------------------------*/ 37 | 38 | NwMiniLogMgrT* nwMiniLogMgrGetInstance() 39 | { 40 | return &(__gLogMgr); 41 | } 42 | 43 | NwRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, NwU32T logLevel ) 44 | { 45 | thiz->logLevel = logLevel; 46 | return NW_OK; 47 | } 48 | 49 | NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel) 50 | { 51 | thiz->logLevel = logLevel; 52 | } 53 | 54 | NwRcT nwMiniLogMgrLogRequest (NwGtpv2cLogMgrHandleT hLogMgr, 55 | NwU32T logLevel, 56 | NwCharT* file, 57 | NwU32T line, 58 | NwCharT* logStr) 59 | { 60 | NwMiniLogMgrT* thiz = (NwMiniLogMgrT*) hLogMgr; 61 | if(thiz->logLevel >= logLevel) 62 | printf("NWGTPV2C-STK %s - %s <%s,%u>\n", gLogLevelStr[logLevel], logStr, basename(file), line); 63 | return NW_OK; 64 | } 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-helloworld/NwMiniLogMgrEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C L O G M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file hello-world.c 11 | * @brief This file contains example of a minimalistic log manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwLog.h" 18 | 19 | #ifndef NW_ASSERT 20 | #define NW_ASSERT assert 21 | #endif 22 | 23 | #ifndef __NW_MINI_LOG_MGR_H__ 24 | #define __NW_MINI_LOG_MGR_H__ 25 | 26 | #define NW_LOG( _logLevel, ...) \ 27 | do { \ 28 | if((nwMiniLogMgrGetInstance())->logLevel >= _logLevel) \ 29 | { \ 30 | char _logStr[1024]; \ 31 | snprintf(_logStr, 1024, __VA_ARGS__); \ 32 | printf("NWGTPV2C-APP %s - %s <%s,%u>\n", gLogLevelStr[_logLevel], _logStr, basename(__FILE__), __LINE__);\ 33 | } \ 34 | } while(0) 35 | 36 | /** 37 | * MiniLogMgr Class Definition 38 | */ 39 | typedef struct NwMiniLogMgr 40 | { 41 | NwU8T logLevel; /*< Log level */ 42 | } NwMiniLogMgrT; 43 | 44 | 45 | /*--------------------------------------------------------------------------- 46 | * Public functions 47 | *--------------------------------------------------------------------------*/ 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /** 54 | * Get global singleton MiniLogMgr instance 55 | */ 56 | NwMiniLogMgrT* nwMiniLogMgrGetInstance(); 57 | 58 | /** 59 | * Initialize MiniLogMgr 60 | * @param thiz : Pointer to global singleton MiniLogMgr instance 61 | * @param logLevel : Log Level 62 | */ 63 | NwRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, NwU32T logLevel ); 64 | 65 | /** 66 | * Set MiniLogMgr log level 67 | * @param thiz : Pointer to global singleton MiniLogMgr instance 68 | * @param logLevel : Log Level 69 | */ 70 | NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel); 71 | 72 | /** 73 | * Process log request from stack 74 | * @param thiz : Pointer to global singleton MiniLogMgr instance 75 | * @param logLevel : Log Level 76 | * @param file : Filename 77 | * @param line : Line Number 78 | * @param logStr : Log string 79 | */ 80 | NwRcT nwMiniLogMgrLogRequest (NwGtpv2cLogMgrHandleT logMgrHandle, 81 | NwU32T logLevel, 82 | NwCharT* file, 83 | NwU32T line, 84 | NwCharT* logStr); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-helloworld/NwMiniTmrMgrEntity.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C T M R M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file NwMiniTmrMgrEntity.c 11 | * @brief This file ontains example of a minimalistic timer manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwGtpv2c.h" 18 | #include "NwMiniLogMgrEntity.h" 19 | #include "NwMiniTmrMgrEntity.h" 20 | 21 | #ifndef NW_ASSERT 22 | #define NW_ASSERT assert 23 | #endif 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | static 30 | NwCharT* gLogLevelStr[] = {"EMER", "ALER", "CRIT", "ERRO", "WARN", "NOTI", "INFO", "DEBG"}; 31 | 32 | /*--------------------------------------------------------------------------- 33 | * Private functions 34 | *--------------------------------------------------------------------------*/ 35 | 36 | static void 37 | NW_TMR_CALLBACK(nwGtpv2cNodeHandleStackTimerTimeout) 38 | { 39 | NwRcT rc; 40 | NwGtpv2cNodeTmrT *pTmr = (NwGtpv2cNodeTmrT*) arg; 41 | 42 | /* 43 | * Send Timeout Request to Gtpv2c Stack Instance 44 | */ 45 | rc = nwGtpv2cProcessTimeout(pTmr->timeoutArg); 46 | NW_ASSERT(NW_OK == rc); 47 | 48 | free(pTmr); 49 | 50 | return; 51 | } 52 | 53 | /*--------------------------------------------------------------------------- 54 | * Public functions 55 | *--------------------------------------------------------------------------*/ 56 | 57 | NwRcT nwTimerStart( NwGtpv2cTimerMgrHandleT tmrMgrHandle, 58 | NwU32T timeoutSec, 59 | NwU32T timeoutUsec, 60 | NwU32T tmrType, 61 | void* timeoutArg, 62 | NwGtpv2cTimerHandleT* hTmr) 63 | { 64 | NwRcT rc = NW_OK; 65 | NwGtpv2cNodeTmrT *pTmr; 66 | struct timeval tv; 67 | 68 | NW_LOG(NW_LOG_LEVEL_DEBG, "Received start timer request from stack with timer type %u, arg %x, for %u sec and %u usec", tmrType, timeoutArg, timeoutSec, timeoutUsec); 69 | 70 | pTmr = (NwGtpv2cNodeTmrT*) malloc(sizeof(NwGtpv2cNodeTmrT)); 71 | 72 | /* set the timevalues*/ 73 | timerclear(&tv); 74 | tv.tv_sec = timeoutSec; 75 | tv.tv_usec = timeoutUsec; 76 | 77 | pTmr->timeoutArg = timeoutArg; 78 | evtimer_set(&pTmr->ev, nwGtpv2cNodeHandleStackTimerTimeout, pTmr); 79 | 80 | /*add event*/ 81 | 82 | event_add(&(pTmr->ev), &tv); 83 | 84 | *hTmr = (NwGtpv2cTimerHandleT)pTmr; 85 | 86 | return rc; 87 | } 88 | 89 | NwRcT nwTimerStop( NwGtpv2cTimerMgrHandleT tmrMgrHandle, 90 | NwGtpv2cTimerHandleT hTmr) 91 | { 92 | NW_LOG(NW_LOG_LEVEL_DEBG, "Received stop timer request from stack for timer handle %u", hTmr); 93 | evtimer_del(&(((NwGtpv2cNodeTmrT*)hTmr)->ev)); 94 | free((void*)hTmr); 95 | return NW_OK; 96 | } 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-helloworld/NwMiniTmrMgrEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C T M R M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | 10 | /** 11 | * @file NwMiniTmrMgrEntity.c 12 | * @brief This file ontains example of a minimalistic timer manager entity. 13 | */ 14 | 15 | #include 16 | #include 17 | #include "NwEvt.h" 18 | #include "NwLog.h" 19 | 20 | #ifndef NW_ASSERT 21 | #define NW_ASSERT assert 22 | #endif 23 | 24 | #ifndef __NW_MINI_TMR_MGR_H__ 25 | #define __NW_MINI_TMR_MGR_H__ 26 | 27 | typedef struct 28 | { 29 | NwU8T _tbd; 30 | } NwGtpv2cNodeTmrMgrT; 31 | 32 | typedef struct 33 | { 34 | NwEventT ev; 35 | void* timeoutArg; 36 | } NwGtpv2cNodeTmrT; 37 | 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | NwRcT nwTimerStart( NwGtpv2cTimerMgrHandleT tmrMgrHandle, 44 | NwU32T timeoutSec, 45 | NwU32T timeoutUsec, 46 | NwU32T tmrType, 47 | void* timeoutArg, 48 | NwGtpv2cTimerHandleT* hTmr); 49 | 50 | 51 | NwRcT nwTimerStop( NwGtpv2cTimerMgrHandleT tmrMgrHandle, 52 | NwGtpv2cTimerHandleT hTmr); 53 | 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-helloworld/NwMiniUdpEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C U D P E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | 10 | /** 11 | * @file NwMiniUdpEntity.c 12 | * @brief This file contains example of a minimalistic ULP entity. 13 | */ 14 | 15 | #include 16 | #include 17 | #include "NwEvt.h" 18 | #include "NwLog.h" 19 | 20 | #ifndef NW_ASSERT 21 | #define NW_ASSERT assert 22 | #endif 23 | 24 | #ifndef __NW_MINI_UDP_ENTITY_H__ 25 | #define __NW_MINI_UDP_ENTITY_H__ 26 | 27 | typedef struct 28 | { 29 | NwU32T hSocket; 30 | NwEventT ev; 31 | NwGtpv2cStackHandleT hGtpv2cStack; 32 | } NwGtpv2cNodeUdpT; 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | NwRcT nwGtpv2cUdpInit(NwGtpv2cNodeUdpT* thiz, NwGtpv2cStackHandleT hGtpv2cStack, NwU8T* ipv4Addr); 39 | 40 | NwRcT nwGtpv2cUdpDestroy(NwGtpv2cNodeUdpT* thiz); 41 | 42 | NwRcT nwGtpv2cUdpDataReq(NwGtpv2cUdpHandleT udpHandle, 43 | NwU8T* dataBuf, 44 | NwU32T dataSize, 45 | NwU32T peerIp, 46 | NwU32T peerPort); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /nw-gtpv2c/test-app/nw-helloworld/NwMiniUlpEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C U L P E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file NwMiniUlpEntity.h 11 | * @brief This file contains example of a minimalistic ULP entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwLog.h" 18 | 19 | #ifndef __NW_MINI_ULP_H__ 20 | #define __NW_MINI_ULP_H__ 21 | 22 | typedef struct 23 | { 24 | NwU8T peerIpStr[16]; 25 | NwU32T restartCounter; 26 | NwGtpv2cStackHandleT hGtpv2cStack; 27 | } NwGtpv2cNodeUlpT; 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | NwRcT 34 | nwGtpv2cUlpInit(NwGtpv2cNodeUlpT* thiz, NwGtpv2cStackHandleT hGtpv2cStack, char* peerIpStr ); 35 | 36 | NwRcT 37 | nwGtpv2cUlpDestroy(NwGtpv2cNodeUlpT* thiz); 38 | 39 | NwRcT 40 | nwGtpv2cUlpCreateSessionRequestToPeer(NwGtpv2cNodeUlpT* thiz); 41 | 42 | NwRcT 43 | nwGtpv2cUlpProcessStackReqCallback (NwGtpv2cUlpHandleT hUlp, 44 | NwGtpv2cUlpApiT *pUlpApi); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /nw-ipv4/AUTHORS: -------------------------------------------------------------------------------- 1 | Amit Chawre 2 | -------------------------------------------------------------------------------- /nw-ipv4/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2011 Amit Chawre 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | -------------------------------------------------------------------------------- /nw-ipv4/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-ipv4/ChangeLog -------------------------------------------------------------------------------- /nw-ipv4/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: Makefile.am 2 | 3 | # the subdirectories of the project to go into 4 | SUBDIRS = \ 5 | src\ 6 | test-app 7 | -------------------------------------------------------------------------------- /nw-ipv4/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-ipv4/NEWS -------------------------------------------------------------------------------- /nw-ipv4/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-ipv4/README -------------------------------------------------------------------------------- /nw-ipv4/shared/NwIpv4Error.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - i p v 4 * 4 | * I n t e r n e t P r o t o c o l v 4 S t a c k * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | 35 | #ifndef __NW_IPv4_ERROR_H__ 36 | #define __NW_IPv4_ERROR_H__ 37 | 38 | /** 39 | * @file NwIpv4Error.h 40 | * @brief This header file contains return error code type definitions. 41 | */ 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | typedef enum { 48 | 49 | NW_IPv4_OK = 0x00000000, 50 | NW_IPv4_FAILURE = 0xFFFFFFFE 51 | } NwIpv4RcT; 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif /* __NW_ERROR_CODE_H__ */ 58 | 59 | 60 | -------------------------------------------------------------------------------- /nw-ipv4/shared/NwUtils.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - i p v 4 * 4 | * I n t e r n e t P r o t o c o l v 4 S t a c k * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | #include 35 | 36 | #ifndef __NW_UTILS_H__ 37 | #define __NW_UTILS_H__ 38 | 39 | 40 | /** 41 | * @file NwUtils.h 42 | * @brief This header file contains utility macro and function definitions. 43 | */ 44 | 45 | #define NW_ASSERT assert /**< Assertion */ 46 | 47 | #define NW_CHK_NULL_PTR(_ptr) NW_ASSERT(_ptr != NULL) /**< Null pointer check */ 48 | 49 | #endif /* __NW_UTILS_H__ */ 50 | 51 | 52 | -------------------------------------------------------------------------------- /nw-ipv4/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: src/mylib/Makefile.am 2 | 3 | # additional include paths necessary to compile the C++ library 4 | AM_CFLAGS = -I$(top_srcdir)/src -I../shared -I../include @AM_CFLAGS@ 5 | 6 | ############################################################################### 7 | # THE LIBRARIES TO BUILD 8 | ############################################################################### 9 | 10 | # the library names to build (note we are building static libs only) 11 | lib_LIBRARIES = libNwIpv4.a 12 | 13 | # where to install the headers on the system 14 | libNwIpv4_adir = $(includedir)/mylib 15 | 16 | # the list of header files that belong to the library (to be installed later) 17 | libNwIpv4_a_HEADERS = \ 18 | ../shared/NwTypes.h\ 19 | ../shared/NwUtils.h\ 20 | ../shared/NwIpv4Error.h\ 21 | ../shared/NwIpv4.h\ 22 | ../include/NwIpv4Private.h\ 23 | ../include/NwIpv4Log.h\ 24 | ../shared/NwIpv4Ie.h\ 25 | ../shared/NwIpv4Msg.h\ 26 | ../include/NwIpv4TunnelEndPoint.h\ 27 | ../include/queue.h\ 28 | ../include/tree.h 29 | 30 | # the sources to add to the library and to add to the source distribution 31 | libNwIpv4_a_SOURCES = \ 32 | $(libNwIpv4_a_HEADERS) \ 33 | NwIpv4TunnelEndPoint.c\ 34 | NwIpv4Msg.c\ 35 | NwIpv4.c 36 | 37 | ############################################################################### 38 | 39 | 40 | -------------------------------------------------------------------------------- /nw-ipv4/test-app/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: Makefile.am 2 | 3 | # the subdirectories of the project to go into 4 | SUBDIRS = \ 5 | nw-helloworld 6 | -------------------------------------------------------------------------------- /nw-ipv4/test-app/nw-helloworld/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = helloworld 2 | 3 | AM_CFLAGS = -D_WITH_LIBEVENT__ -I../../shared -I../../include -I../../test-app/nw-udp -I../../test-app/nw-log -I../../../nw-event/include @AM_CFLAGS@ 4 | 5 | helloworld_SOURCES = \ 6 | NwEvt.h\ 7 | NwMiniLogMgrEntity.h\ 8 | NwMiniTmrMgrEntity.h\ 9 | NwMiniUlpEntity.h\ 10 | NwMiniLlpEntity.h\ 11 | NwMiniLogMgrEntity.c\ 12 | NwMiniTmrMgrEntity.c\ 13 | NwMiniUlpEntity.c\ 14 | NwMiniLlpEntity.c\ 15 | helloworld.c 16 | 17 | helloworld_LDADD = ../../src/libNwIpv4.a -levent $(AM_LDFLAGS) 18 | -------------------------------------------------------------------------------- /nw-ipv4/test-app/nw-helloworld/NwMiniLlpEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C U D P E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | 10 | /** 11 | * @file NwMiniLlpEntity.h 12 | * @brief This file contains example of a minimalistic ULP entity. 13 | */ 14 | 15 | #include 16 | #include 17 | #include "NwEvt.h" 18 | 19 | #ifndef NW_ASSERT 20 | #define NW_ASSERT assert 21 | #endif 22 | 23 | #ifndef __NW_MINI_UDP_ENTITY_H__ 24 | #define __NW_MINI_UDP_ENTITY_H__ 25 | 26 | typedef struct 27 | { 28 | NwU32T hSocket; 29 | NwEventT ev; 30 | NwIpv4StackHandleT hIpv4Stack; 31 | } NwMiniLlpEntityT; 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | NwIpv4RcT nwMiniUdpInit(NwMiniLlpEntityT* thiz, NwIpv4StackHandleT hIpv4Stack, NwU8T* ipAddr); 38 | 39 | NwIpv4RcT nwMiniUdpDestroy(NwMiniLlpEntityT* thiz); 40 | 41 | NwIpv4RcT nwMiniUdpDataReq(NwIpv4LlpHandleT llpHandle, 42 | NwU8T* dataBuf, 43 | NwU32T dataSize, 44 | NwU32T peerAddr, 45 | NwU32T peerPort); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /nw-ipv4/test-app/nw-helloworld/NwMiniLogMgrEntity.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C L O G M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file hello-world.c 11 | * @brief This file contains example of a minimalistic log manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwIpv4.h" 18 | 19 | #include "NwMiniLogMgrEntity.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | NwU32T g_log_level = NW_LOG_LEVEL_INFO; 26 | 27 | /*--------------------------------------------------------------------------- 28 | * Public functions 29 | *--------------------------------------------------------------------------*/ 30 | 31 | NwIpv4RcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, NwU32T logLevel ) 32 | { 33 | thiz->logLevel = logLevel; 34 | return NW_IPv4_OK; 35 | } 36 | 37 | NwIpv4RcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel) 38 | { 39 | thiz->logLevel = logLevel; 40 | } 41 | 42 | NwIpv4RcT nwMiniLogMgrLogRequest (NwIpv4LogMgrHandleT hLogMgr, 43 | NwU32T logLevel, 44 | NwCharT* file, 45 | NwU32T line, 46 | NwCharT* logStr) 47 | { 48 | NwMiniLogMgrT* thiz = (NwMiniLogMgrT*) hLogMgr; 49 | if(thiz->logLevel >= logLevel) 50 | printf("NWIPv4-STK %s - %s <%s,%u>\n", ipv4LogLevelStr[logLevel], logStr, basename(file), line); 51 | return NW_IPv4_OK; 52 | } 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /nw-ipv4/test-app/nw-helloworld/NwMiniLogMgrEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C L O G M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file hello-world.c 11 | * @brief This file contains example of a minimalistic log manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwTypes.h" 18 | #include "NwIpv4Error.h" 19 | #include "NwIpv4.h" 20 | 21 | #ifndef NW_ASSERT 22 | #define NW_ASSERT assert 23 | #endif 24 | 25 | #ifndef __NW_MINI_LOG_MGR_H__ 26 | #define __NW_MINI_LOG_MGR_H__ 27 | 28 | extern NwU32T g_log_level; 29 | 30 | 31 | #define NW_LOG( _logLevel, ...) \ 32 | do { \ 33 | if(g_log_level >= _logLevel) \ 34 | { \ 35 | char _logStr[1024]; \ 36 | snprintf(_logStr, 1024, __VA_ARGS__); \ 37 | printf("NWIPv4-APP %s - %s <%s,%u>\n", ipv4LogLevelStr[_logLevel], _logStr, basename(__FILE__), __LINE__);\ 38 | } \ 39 | } while(0) 40 | 41 | typedef struct 42 | { 43 | NwU8T logLevel; 44 | } NwMiniLogMgrT; 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | NwIpv4RcT nwMiniLogMgrLogRequest (NwIpv4LogMgrHandleT logMgrHandle, 51 | NwU32T logLevel, 52 | NwCharT* file, 53 | NwU32T line, 54 | NwCharT* logStr); 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /nw-ipv4/test-app/nw-helloworld/NwMiniTmrMgrEntity.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C T M R M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file NwMiniTmrMgrEntity.c 11 | * @brief This file ontains example of a minimalistic timer manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwIpv4.h" 18 | #include "NwMiniLogMgrEntity.h" 19 | #include "NwMiniTmrMgrEntity.h" 20 | 21 | #ifndef NW_ASSERT 22 | #define NW_ASSERT assert 23 | #endif 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /*--------------------------------------------------------------------------- 30 | * Private functions 31 | *--------------------------------------------------------------------------*/ 32 | 33 | static void 34 | NW_TMR_CALLBACK(nwMiniTmrMgrHandleTimeout) 35 | { 36 | NwIpv4RcT rc; 37 | #ifdef __WITH_LIBEVENT__ 38 | NwMiniTmrT *pTmr = (NwMiniTmrT*) arg; 39 | 40 | /*--------------------------------------------------------------------------- 41 | * Send Timeout Request to IPv4 Stack Instance 42 | *--------------------------------------------------------------------------*/ 43 | 44 | rc = nwIpv4ProcessTimeout(pTmr->timeoutArg); 45 | NW_ASSERT( rc == NW_IPv4_OK ); 46 | free(pTmr); 47 | #else 48 | #warning "Timer library not defined!" 49 | #endif 50 | 51 | 52 | return; 53 | } 54 | 55 | /*--------------------------------------------------------------------------- 56 | * Public functions 57 | *--------------------------------------------------------------------------*/ 58 | 59 | NwIpv4RcT nwTimerStart( NwIpv4TimerMgrHandleT tmrMgrHandle, 60 | NwU32T timeoutSec, 61 | NwU32T timeoutUsec, 62 | NwU32T tmrType, 63 | void* timeoutArg, 64 | NwIpv4TimerHandleT* hTmr) 65 | { 66 | NwIpv4RcT rc = NW_IPv4_OK; 67 | 68 | NW_LOG(NW_LOG_LEVEL_INFO, "Received start timer request from stack with timer type %u, arg %x, for %u sec and %u usec", tmrType, timeoutArg, timeoutSec, timeoutUsec); 69 | 70 | #ifdef __WITH_LIBEVENT__ 71 | NwMiniTmrT *pTmr; 72 | struct timeval tv; 73 | pTmr = (NwMiniTmrT*) malloc (sizeof(NwMiniTmrT)); 74 | 75 | /* set the timevalues*/ 76 | timerclear(&tv); 77 | tv.tv_sec = timeoutSec; 78 | tv.tv_usec = timeoutUsec; 79 | 80 | pTmr->timeoutArg = timeoutArg; 81 | /*add event*/ 82 | evtimer_set(&pTmr->ev, nwMiniTmrMgrHandleTimeout, pTmr); 83 | event_add(&(pTmr->ev), &tv); 84 | *hTmr = (NwIpv4TimerHandleT)pTmr; 85 | #else 86 | #warning "Timer library not defined!" 87 | #endif 88 | 89 | 90 | return NW_IPv4_OK; 91 | } 92 | 93 | NwIpv4RcT nwTimerStop( NwIpv4TimerMgrHandleT tmrMgrHandle, 94 | NwIpv4TimerHandleT hTmr) 95 | { 96 | NW_LOG(NW_LOG_LEVEL_INFO, "Received stop timer request from stack for timer handle %u", hTmr); 97 | #ifdef __WITH_LIBEVENT__ 98 | evtimer_del(&(((NwMiniTmrT*)hTmr)->ev)); 99 | free((void*)hTmr); 100 | #else 101 | #warning "Timer library not defined!" 102 | #endif 103 | 104 | return NW_IPv4_OK; 105 | } 106 | 107 | #ifdef __cplusplus 108 | } 109 | #endif 110 | -------------------------------------------------------------------------------- /nw-ipv4/test-app/nw-helloworld/NwMiniTmrMgrEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C T M R M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | 10 | /** 11 | * @file NwMiniTmrMgrEntity.h 12 | * @brief This file ontains example of a minimalistic timer manager entity. 13 | */ 14 | 15 | #include 16 | #include 17 | #include "NwEvt.h" 18 | 19 | #ifndef NW_ASSERT 20 | #define NW_ASSERT assert 21 | #endif 22 | 23 | #ifndef __NW_MINI_TMR_MGR_H__ 24 | #define __NW_MINI_TMR_MGR_H__ 25 | 26 | typedef struct 27 | { 28 | NwEventT ev; 29 | void* timeoutArg; 30 | } NwMiniTmrT; 31 | 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | NwIpv4RcT nwTimerStart( NwIpv4TimerMgrHandleT tmrMgrHandle, 38 | NwU32T timeoutSec, 39 | NwU32T timeoutUsec, 40 | NwU32T tmrType, 41 | void* timeoutArg, 42 | NwIpv4TimerHandleT* hTmr); 43 | 44 | 45 | NwIpv4RcT nwTimerStop( NwIpv4TimerMgrHandleT tmrMgrHandle, 46 | NwIpv4TimerHandleT hTmr); 47 | 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /nw-ipv4/test-app/nw-helloworld/NwMiniUlpEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C U L P E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file NwMiniUlpEntity.h 11 | * @brief This file contains example of a minimalistic ULP entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #ifndef __NW_MINI_ULP_H__ 18 | #define __NW_MINI_ULP_H__ 19 | 20 | typedef struct 21 | { 22 | int hSocket; 23 | NwU16T seqNum; 24 | NwU8T restartCounter; 25 | NwU8T localIpStr[16]; 26 | NwU8T peerIpStr[16]; 27 | NwU32T localPort[1025]; 28 | NwEventT ev[1025]; 29 | NwIpv4StackHandleT hIpv4Stack; 30 | NwIpv4StackSessionHandleT hIpv4Conn; 31 | } NwMiniUlpEntityT; 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | NwIpv4RcT 38 | nwMiniUlpInit(NwMiniUlpEntityT* thiz, NwIpv4StackHandleT hIpv4Stack); 39 | 40 | NwIpv4RcT 41 | nwMiniUlpDestroy(NwMiniUlpEntityT* thiz); 42 | 43 | NwIpv4RcT 44 | nwMiniUlpCreateConn(NwMiniUlpEntityT* thiz, char* localIpStr, NwU16T localPort, char* peerIpStr); 45 | 46 | NwIpv4RcT 47 | nwMiniUlpDestroyConn(NwMiniUlpEntityT* thiz); 48 | 49 | NwIpv4RcT 50 | nwMiniUlpSendMsg(NwMiniUlpEntityT* thiz); 51 | 52 | NwIpv4RcT 53 | nwMiniUlpTpduSend(NwMiniUlpEntityT* thiz, NwU8T* tpduBuf, NwU32T tpduLen , NwU16T fromPort); 54 | 55 | NwIpv4RcT 56 | nwMiniUlpProcessStackReqCallback (NwIpv4UlpHandleT hUlp, 57 | NwIpv4UlpApiT *pUlpApi); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /nw-mme-emu/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: src/bin/Makefile.am 2 | 3 | # additional include paths necessary to compile the C++ programs 4 | AM_CFLAGS = -I$(top_srcdir)/nw-gtpv2c/shared -I$(top_srcdir)/nw-gtpv1u/shared -I$(top_srcdir)/nw-sdp/shared -I$(top_srcdir)/common -I$(top_srcdir)/include -I$(top_srcdir)/utils/nw-ipv4-if -I$(top_srcdir)/utils/nw-gtpv2c-if -I$(top_srcdir)/utils/nw-gtpu-if -I$(top_srcdir)/utils/nw-udp -I$(top_srcdir)/utils/nw-log -I$(top_srcdir)/utils/nw-tmr -I$(top_srcdir)/nw-event/include @AM_CFLAGS@ 5 | 6 | ############################################################################### 7 | # THE PROGRAMS TO BUILD 8 | ############################################################################### 9 | 10 | # the program to build (the names of the final binaries) 11 | bin_PROGRAMS = nwLteMmeEmu 12 | 13 | # list of sources for the 'NwWimaxBsEmu' binary 14 | nwLteMmeEmu_SOURCES = \ 15 | ../common/tree.h\ 16 | ../common/queue.h\ 17 | ../common/NwTypes.h\ 18 | ../common/NwError.h\ 19 | ../common/NwLog.h\ 20 | ../common/NwUtils.h\ 21 | ../common/NwMem.h\ 22 | ../utils/nw-ipv4-if/NwIpv4IfLog.h\ 23 | ../utils/nw-ipv4-if/NwIpv4If.h\ 24 | ../utils/nw-gtpu-if/NwGtpv1uIfLog.h\ 25 | ../utils/nw-gtpu-if/NwGtpv1uIf.h\ 26 | ../utils/nw-tmr/NwTmrMgr.h\ 27 | ../utils/nw-log/NwLogMgr.h\ 28 | ../utils/nw-udp/NwUdpLog.h\ 29 | ../utils/nw-udp/NwUdp.h\ 30 | ../utils/nw-tmr/NwTmrMgr.c\ 31 | ../utils/nw-log/NwLogMgr.c\ 32 | ../utils/nw-udp/NwUdp.c\ 33 | ../utils/nw-ipv4-if/NwIpv4If.c\ 34 | ../utils/nw-gtpu-if/NwGtpv1uIf.c\ 35 | ../nw-gtpv2c/shared/NwGtpv2c.h\ 36 | ../nw-gtpv2c/shared/NwGtpv2cIe.h\ 37 | ../nw-gtpv2c/shared/NwGtpv2cMsg.h\ 38 | ../nw-gtpv2c/shared/NwGtpv2cMsgParser.h\ 39 | ../common/NwMem.c\ 40 | NwMmeLog.h\ 41 | NwMmeUeLog.h\ 42 | NwMmeUlp.h\ 43 | NwMmeDpe.h\ 44 | NwMmeUe.h\ 45 | NwMmeUlp.c\ 46 | NwMmeDpe.c\ 47 | NwMmeMain.c\ 48 | NwMmeUe.c 49 | 50 | # the additional libraries needed to link nwWimaxBsEmu 51 | nwLteMmeEmu_LDADD = $(top_builddir)/nw-gtpv2c/src/libNwGtpv2c.a $(top_builddir)/nw-sdp/src/libNwSdp.a $(top_builddir)/nw-gtpv1u/src/libNwGtpv1u.a $(top_builddir)/nw-gre/src/libNwGre.a $(top_builddir)/nw-ipv4/src/libNwIpv4.a $(top_builddir)/nw-event/src/libNwEvent.a $(AM_LDFLAGS) 52 | 53 | ############################################################################### 54 | -------------------------------------------------------------------------------- /nw-sae-gw/NwSaeGwUeFsm.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - e p c * 4 | * L T E / S A E S E R V I N G / P D N G A T E W A Y * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | /** 35 | * @file NwSaeGwUeFsm.c 36 | */ 37 | 38 | #ifndef __NW_SAEGW_UE_FSM_H__ 39 | #define __NW_SAEGW_UE_FSM_H__ 40 | 41 | #include 42 | #include 43 | 44 | #include "NwLog.h" 45 | #include "NwTypes.h" 46 | #include "NwUtils.h" 47 | #include "NwSaeGwUeState.h" 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | typedef struct { 54 | NwSaeUeStateT *pState[NW_SAE_GW_UE_STATE_END + 1]; 55 | } NwSaeGwUeFsmT; 56 | 57 | extern NwSaeGwUeFsmT* 58 | NwSaeGwUeFsmNew(); 59 | 60 | extern NwRcT 61 | NwSaeGwUeFsmDelete(NwSaeGwUeFsmT* thiz); 62 | 63 | extern NwRcT 64 | nwSaeGwUeFsmRun(NwSaeGwUeFsmT* thiz, NwSaeGwUeT* pUe, NwSaeGwUeEventInfoT* pEv, NwUeStateT* pUeState); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /nw-sae-gw/NwSaeGwUeStateAwaitPgwCreateSessionRsp.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - e p c * 4 | * L T E / S A E S E R V I N G / P D N G A T E W A Y * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | /** 35 | * @file NwSaeGwUeInitState.h 36 | */ 37 | #ifndef __NW_SAE_GW_UE_STATE_AWAIT_PGW_CREATE_SESSION_RSP_H__ 38 | #define __NW_SAE_GW_UE_STATE_AWAIT_PGW_CREATE_SESSION_RSP_H__ 39 | 40 | #include 41 | #include 42 | 43 | #include "NwLog.h" 44 | #include "NwTypes.h" 45 | #include "NwUtils.h" 46 | #include "NwSaeGwUeState.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** 53 | * Constructor 54 | */ 55 | 56 | NwSaeUeStateT* 57 | nwSaeGwStateAwaitPgwCreateSessionRspNew(); 58 | 59 | /** 60 | * Destructor 61 | */ 62 | 63 | NwRcT 64 | nwSaeGwStateAwaitPgwCreateSessionRspDelete(NwSaeUeStateT* thiz); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /nw-sae-gw/NwSaeGwUeStateAwaitPgwDeleteSessionRsp.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - e p c * 4 | * L T E / S A E S E R V I N G / P D N G A T E W A Y * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | /** 35 | * @file NwSaeGwUeInitState.h 36 | */ 37 | #ifndef __NW_SAE_GW_UE_STATE_AWAIT_PGW_DELETE_SESSION_RSP_H__ 38 | #define __NW_SAE_GW_UE_STATE_AWAIT_PGW_DELETE_SESSION_RSP_H__ 39 | 40 | #include 41 | #include 42 | 43 | #include "NwLog.h" 44 | #include "NwTypes.h" 45 | #include "NwUtils.h" 46 | #include "NwSaeGwUeState.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** 53 | * Constructor 54 | */ 55 | 56 | NwSaeUeStateT* 57 | nwSaeGwStateAwaitPgwDeleteSessionRspNew(); 58 | 59 | /** 60 | * Destructor 61 | */ 62 | 63 | NwRcT 64 | nwSaeGwStateAwaitPgwDeleteSessionRspDelete(NwSaeUeStateT* thiz); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /nw-sae-gw/NwSaeGwUeStateAwaitPgwModifyBearerRsp.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - e p c * 4 | * L T E / S A E S E R V I N G / P D N G A T E W A Y * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | /** 35 | * @file NwSaeGwUeInitState.h 36 | */ 37 | #ifndef __NW_SAE_GW_UE_STATE_AWAIT_PGW_MODIFY_BEARER_RSP_H__ 38 | #define __NW_SAE_GW_UE_STATE_AWAIT_PGW_MODIFY_BEARER_RSP_H__ 39 | 40 | #include 41 | #include 42 | 43 | #include "NwLog.h" 44 | #include "NwTypes.h" 45 | #include "NwUtils.h" 46 | #include "NwSaeGwUeState.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** 53 | * Constructor 54 | */ 55 | 56 | NwSaeUeStateT* 57 | nwSaeGwStateAwaitPgwModifyBearerRspNew(); 58 | 59 | /** 60 | * Destructor 61 | */ 62 | 63 | NwRcT 64 | nwSaeGwStateAwaitPgwModifyBearerRspDelete(NwSaeUeStateT* thiz); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /nw-sae-gw/NwSaeGwUeStateAwaitPgwModifyBearerRsp2.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - e p c * 4 | * L T E / S A E S E R V I N G / P D N G A T E W A Y * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | /** 35 | * @file NwSaeGwUeStateAwaitPgwModifyBearerRsp2.h 36 | */ 37 | #ifndef __NW_SAE_GW_UE_STATE_AWAIT_PGW_MODIFY_BEARER_RSP2_H__ 38 | #define __NW_SAE_GW_UE_STATE_AWAIT_PGW_MODIFY_BEARER_RSP2_H__ 39 | 40 | #include 41 | #include 42 | 43 | #include "NwLog.h" 44 | #include "NwTypes.h" 45 | #include "NwUtils.h" 46 | #include "NwSaeGwUeState.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** 53 | * Constructor 54 | */ 55 | 56 | NwSaeUeStateT* 57 | nwSaeGwStateAwaitPgwModifyBearerRsp2New(); 58 | 59 | /** 60 | * Destructor 61 | */ 62 | 63 | NwRcT 64 | nwSaeGwStateAwaitPgwModifyBearerRsp2Delete(NwSaeUeStateT* thiz); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /nw-sae-gw/NwSaeGwUeStateInit.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - e p c * 4 | * L T E / S A E S E R V I N G / P D N G A T E W A Y * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | /** 35 | * @file NwSaeGwUeInitState.h 36 | */ 37 | #ifndef __NW_SAE_GW_UE_STATE_INIT_H__ 38 | #define __NW_SAE_GW_UE_STATE_INIT_H__ 39 | 40 | #include 41 | #include 42 | 43 | #include "NwLog.h" 44 | #include "NwTypes.h" 45 | #include "NwUtils.h" 46 | #include "NwSaeGwUeState.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** 53 | * Constructor 54 | */ 55 | 56 | NwSaeUeStateT* 57 | nwSaeGwStateInitNew(); 58 | 59 | /** 60 | * Destructor 61 | */ 62 | 63 | NwRcT 64 | nwSaeGwStateInitDelete(NwSaeUeStateT* thiz); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /nw-sae-gw/NwSaeGwUeStatePgwSessionCreated.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - e p c * 4 | * L T E / S A E S E R V I N G / P D N G A T E W A Y * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | /** 35 | * @file NwSaeGwUeStateSessionCreated.h 36 | */ 37 | #ifndef __NW_SAE_GW_UE_STATE_PGW_SESSION_CREATED_H__ 38 | #define __NW_SAE_GW_UE_STATE_PGW_SESSION_CREATED_H__ 39 | 40 | #include 41 | #include 42 | 43 | #include "NwLog.h" 44 | #include "NwTypes.h" 45 | #include "NwUtils.h" 46 | #include "NwSaeGwUeState.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** 53 | * Constructor 54 | */ 55 | 56 | NwSaeUeStateT* 57 | nwSaeGwStatePgwSessionCreatedNew(); 58 | 59 | /** 60 | * Destructor 61 | */ 62 | 63 | NwRcT 64 | nwSaeGwStatePgwSessionCreatedDelete(NwSaeUeStateT* thiz); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /nw-sae-gw/NwSaeGwUeStateSaeSessionCreated.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - e p c * 4 | * L T E / S A E S E R V I N G / P D N G A T E W A Y * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | /** 35 | * @file NwSaeGwUeStateSessionCreated.h 36 | */ 37 | #ifndef __NW_SAE_GW_UE_STATE_SESSION_CREATED_H__ 38 | #define __NW_SAE_GW_UE_STATE_SESSION_CREATED_H__ 39 | 40 | #include 41 | #include 42 | 43 | #include "NwLog.h" 44 | #include "NwTypes.h" 45 | #include "NwUtils.h" 46 | #include "NwSaeGwUeState.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** 53 | * Constructor 54 | */ 55 | 56 | NwSaeUeStateT* 57 | nwSaeGwStateSaeSessionCreatedNew(); 58 | 59 | /** 60 | * Destructor 61 | */ 62 | 63 | NwRcT 64 | nwSaeGwStateSaeSessionCreatedDelete(NwSaeUeStateT* thiz); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /nw-sae-gw/NwSaeGwUeStateSaeSessionEstablished.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - e p c * 4 | * L T E / S A E S E R V I N G / P D N G A T E W A Y * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | /** 35 | * @file NwSaeGwUeStateSessionEstablished.h 36 | */ 37 | #ifndef __NW_SAE_GW_UE_STATE_SESSION_ESTD_H__ 38 | #define __NW_SAE_GW_UE_STATE_SESSION_ESTD_H__ 39 | 40 | #include 41 | #include 42 | 43 | #include "NwLog.h" 44 | #include "NwTypes.h" 45 | #include "NwUtils.h" 46 | #include "NwSaeGwUeState.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** 53 | * Constructor 54 | */ 55 | 56 | NwSaeUeStateT* 57 | nwSaeGwStateSaeSessionEstablishedNew(); 58 | 59 | /** 60 | * Destructor 61 | */ 62 | 63 | NwRcT 64 | nwSaeGwStateSaeSessionEstablishedDelete(NwSaeUeStateT* thiz); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /nw-sae-gw/NwSaeGwUeStateSgwSessionCreated.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - e p c * 4 | * L T E / S A E S E R V I N G / P D N G A T E W A Y * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | /** 35 | * @file NwSaeGwUeStateSgwSessionCreated.h 36 | */ 37 | #ifndef __NW_SAE_GW_UE_STATE_SGW_SESSION_CREATED_H__ 38 | #define __NW_SAE_GW_UE_STATE_SGW_SESSION_CREATED_H__ 39 | 40 | #include 41 | #include 42 | 43 | #include "NwLog.h" 44 | #include "NwTypes.h" 45 | #include "NwUtils.h" 46 | #include "NwSaeGwUeState.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** 53 | * Constructor 54 | */ 55 | 56 | NwSaeUeStateT* 57 | nwSaeGwStateSgwSessionCreatedNew(); 58 | 59 | /** 60 | * Destructor 61 | */ 62 | 63 | NwRcT 64 | nwSaeGwStateSgwSessionCreatedDelete(NwSaeUeStateT* thiz); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /nw-sae-gw/NwSaeGwUeStateSgwSessionEstablished.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - e p c * 4 | * L T E / S A E S E R V I N G / P D N G A T E W A Y * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | /** 35 | * @file NwSaeGwUeStateSgwSessionEstablished.h 36 | */ 37 | #ifndef __NW_SAE_GW_UE_STATE_SGW_SESSION_ESTD_H__ 38 | #define __NW_SAE_GW_UE_STATE_SGW_SESSION_ESTD_H__ 39 | 40 | #include 41 | #include 42 | 43 | #include "NwLog.h" 44 | #include "NwTypes.h" 45 | #include "NwUtils.h" 46 | #include "NwSaeGwUeState.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** 53 | * Constructor 54 | */ 55 | 56 | NwSaeUeStateT* 57 | nwSaeGwStateSgwSessionEstablishedNew(); 58 | 59 | /** 60 | * Destructor 61 | */ 62 | 63 | NwRcT 64 | nwSaeGwStateSgwSessionEstablishedDelete(NwSaeUeStateT* thiz); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /nw-sdp/AUTHORS: -------------------------------------------------------------------------------- 1 | Amit Chawre 2 | -------------------------------------------------------------------------------- /nw-sdp/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2011 Amit Chawre 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | -------------------------------------------------------------------------------- /nw-sdp/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-sdp/ChangeLog -------------------------------------------------------------------------------- /nw-sdp/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: Makefile.am 2 | 3 | # the subdirectories of the project to go into 4 | SUBDIRS = \ 5 | src\ 6 | test-app 7 | -------------------------------------------------------------------------------- /nw-sdp/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-sdp/NEWS -------------------------------------------------------------------------------- /nw-sdp/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thomasbhatia/nwEPC---EPC-SAE-Gateway/be54639e4e0fc5dea52669ab74397f63fb1568c1/nw-sdp/README -------------------------------------------------------------------------------- /nw-sdp/shared/NwSdpError.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * n w - s d p * 4 | * S o f t D a t a P l a n e * 5 | * * 6 | * * 7 | * Copyright (c) 2010-2011 Amit Chawre * 8 | * All rights reserved. * 9 | * * 10 | * Redistribution and use in source and binary forms, with or without * 11 | * modification, are permitted provided that the following conditions * 12 | * are met: * 13 | * * 14 | * 1. Redistributions of source code must retain the above copyright * 15 | * notice, this list of conditions and the following disclaimer. * 16 | * 2. Redistributions in binary form must reproduce the above copyright * 17 | * notice, this list of conditions and the following disclaimer in the * 18 | * documentation and/or other materials provided with the distribution. * 19 | * 3. The name of the author may not be used to endorse or promote products * 20 | * derived from this software without specific prior written permission. * 21 | * * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 25 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 32 | *----------------------------------------------------------------------------*/ 33 | 34 | 35 | #ifndef __NW_SDP_ERROR_H__ 36 | #define __NW_SDP_ERROR_H__ 37 | 38 | /** 39 | * @file NwSdpError.h 40 | * @brief This header file contains return error code type definitions. 41 | */ 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | typedef enum { 48 | 49 | NW_SDP_OK = 0x00000000, 50 | NW_SDP_FAILURE = 0xFFFFFFFE 51 | } NwSdpRcT; 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif /* __NW_ERROR_CODE_H__ */ 58 | 59 | 60 | -------------------------------------------------------------------------------- /nw-sdp/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: src/mylib/Makefile.am 2 | 3 | # additional include paths necessary to compile the C++ library 4 | AM_CFLAGS = -Wall -I$(top_srcdir)/src -I../../common -I../shared -I../include -I../../nw-gtpv1u/shared -I../../nw-gre/shared -I../../nw-ipv4/shared @AM_CFLAGS@ 5 | 6 | ############################################################################### 7 | # THE LIBRARIES TO BUILD 8 | ############################################################################### 9 | 10 | # the library names to build (note we are building static libs only) 11 | lib_LIBRARIES = libNwSdp.a 12 | 13 | # where to install the headers on the system 14 | libNwSdp_adir = $(includedir)/mylib 15 | 16 | # the list of header files that belong to the library (to be installed later) 17 | libNwSdp_a_HEADERS = \ 18 | ../../common/NwTypes.h\ 19 | ../shared/NwUtils.h\ 20 | ../shared/NwSdpError.h\ 21 | ../shared/NwLog.h\ 22 | ../include/NwSdpLog.h\ 23 | ../include/NwSdpPrivate.h\ 24 | ../include/NwSdpFlowContext.h\ 25 | ../include/queue.h\ 26 | ../include/tree.h 27 | 28 | # the sources to add to the library and to add to the source distribution 29 | libNwSdp_a_SOURCES = \ 30 | $(libNwSdp_a_HEADERS) \ 31 | NwSdpFlowContext.c \ 32 | NwSdp.c 33 | 34 | ############################################################################### 35 | 36 | 37 | -------------------------------------------------------------------------------- /nw-sdp/test-app/Makefile.am: -------------------------------------------------------------------------------- 1 | # this is example-file: Makefile.am 2 | 3 | # the subdirectories of the project to go into 4 | SUBDIRS = \ 5 | nw-helloworld 6 | -------------------------------------------------------------------------------- /nw-sdp/test-app/nw-helloworld/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = helloworld 2 | 3 | AM_CFLAGS = -D__WITH_LIBEVENT__ -I../../../nw-gtpv1u/shared -I../../../common -I../../shared -I../..//include -I../../../utils/nw-evt -I../../../nw-event/include @AM_CFLAGS@ 4 | #AM_CFLAGS = -I../../../nw-gtpv1u/shared -I../../../common -I../../shared -I../..//include -I$../../test-app/nw-udp -I../../test-app/nw-log @AM_CFLAGS@ 5 | 6 | helloworld_SOURCES = \ 7 | NwMiniLogMgrEntity.h\ 8 | NwMiniTmrMgrEntity.h\ 9 | NwMiniUlpEntity.h\ 10 | NwMiniUdpEntity.h\ 11 | NwMiniLogMgrEntity.c\ 12 | NwMiniTmrMgrEntity.c\ 13 | NwMiniUlpEntity.c\ 14 | NwMiniUdpEntity.c\ 15 | helloworld.c 16 | 17 | #helloworld_LDADD = $(top_builddir)/src/libNwSdp.a -levent $(AM_LDFLAGS) 18 | helloworld_LDADD = ../../src/libNwSdp.a ../../../nw-gtpv1u/src/libNwGtpv1u.a ../../../nw-gre/src/libNwGre.a ../../../nw-ipv4/src/libNwIpv4.a -levent $(AM_LDFLAGS) 19 | -------------------------------------------------------------------------------- /nw-sdp/test-app/nw-helloworld/NwMiniLogMgrEntity.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C L O G M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file hello-world.c 11 | * @brief This file contains example of a minimalistic log manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwLog.h" 17 | #include "NwSdp.h" 18 | 19 | #include "NwMiniLogMgrEntity.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | NwU32T g_log_level = NW_LOG_LEVEL_INFO; 26 | 27 | /*--------------------------------------------------------------------------- 28 | * Public functions 29 | *--------------------------------------------------------------------------*/ 30 | 31 | NwSdpRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, NwU32T logLevel ) 32 | { 33 | thiz->logLevel = logLevel; 34 | return NW_SDP_OK; 35 | } 36 | 37 | NwSdpRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel) 38 | { 39 | thiz->logLevel = logLevel; 40 | } 41 | 42 | NwSdpRcT nwMiniLogMgrLogRequest (NwSdpLogMgrHandleT hLogMgr, 43 | NwU32T logLevel, 44 | NwCharT* file, 45 | NwU32T line, 46 | NwCharT* logStr) 47 | { 48 | NwMiniLogMgrT* thiz = (NwMiniLogMgrT*) hLogMgr; 49 | if(thiz->logLevel >= logLevel) 50 | printf("NWSDP-ULP %s - %s <%s,%u>\n", gLogLevelStr[logLevel], logStr, basename(file), line); 51 | return NW_SDP_OK; 52 | } 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /nw-sdp/test-app/nw-helloworld/NwMiniLogMgrEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C L O G M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file hello-world.c 11 | * @brief This file contains example of a minimalistic log manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwLog.h" 18 | 19 | #ifndef NW_ASSERT 20 | #define NW_ASSERT assert 21 | #endif 22 | 23 | #ifndef __NW_MINI_LOG_MGR_H__ 24 | #define __NW_MINI_LOG_MGR_H__ 25 | 26 | extern NwU32T g_log_level; 27 | 28 | 29 | 30 | #define NW_LOG( _logLevel, ...) \ 31 | do { \ 32 | if(g_log_level >= _logLevel) \ 33 | { \ 34 | char _logStr[1024]; \ 35 | snprintf(_logStr, 1024, __VA_ARGS__); \ 36 | printf("NWGTPv2U-APP %s - %s <%s,%u>\n", gLogLevelStr[_logLevel], _logStr, basename(__FILE__), __LINE__);\ 37 | } \ 38 | } while(0) 39 | 40 | typedef struct 41 | { 42 | NwU8T logLevel; 43 | } NwMiniLogMgrT; 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | NwSdpRcT nwMiniLogMgrLogRequest (NwSdpLogMgrHandleT logMgrHandle, 50 | NwU32T logLevel, 51 | NwCharT* file, 52 | NwU32T line, 53 | NwCharT* logStr); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /nw-sdp/test-app/nw-helloworld/NwMiniTmrMgrEntity.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C T M R M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file NwMiniTmrMgrEntity.c 11 | * @brief This file ontains example of a minimalistic timer manager entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwSdp.h" 18 | #include "NwMiniLogMgrEntity.h" 19 | #include "NwMiniTmrMgrEntity.h" 20 | 21 | #ifndef NW_ASSERT 22 | #define NW_ASSERT assert 23 | #endif 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /*--------------------------------------------------------------------------- 30 | * Private functions 31 | *--------------------------------------------------------------------------*/ 32 | 33 | static void 34 | NW_TMR_CALLBACK(nwMiniTmrMgrHandleTimeout) 35 | { 36 | NwSdpRcT rc; 37 | NwMiniTmrT *pTmr = (NwMiniTmrT*) arg; 38 | 39 | /*--------------------------------------------------------------------------- 40 | * Send Timeout Request to GTPv1u Stack Instance 41 | *--------------------------------------------------------------------------*/ 42 | 43 | rc = nwSdpProcessTimeout(pTmr->timeoutArg); 44 | NW_ASSERT( rc == NW_SDP_OK ); 45 | 46 | free(pTmr); 47 | 48 | return; 49 | } 50 | 51 | /*--------------------------------------------------------------------------- 52 | * Public functions 53 | *--------------------------------------------------------------------------*/ 54 | 55 | NwSdpRcT nwTimerStart( NwSdpTimerMgrHandleT tmrMgrHandle, 56 | NwU32T timeoutSec, 57 | NwU32T timeoutUsec, 58 | NwU32T tmrType, 59 | void* timeoutArg, 60 | NwSdpTimerHandleT* hTmr) 61 | { 62 | NwSdpRcT rc = NW_SDP_OK; 63 | NwMiniTmrT *pTmr; 64 | struct timeval tv; 65 | 66 | NW_LOG(NW_LOG_LEVEL_INFO, "Received start timer request from stack with timer type %u, arg %x, for %u sec and %u usec", tmrType, timeoutArg, timeoutSec, timeoutUsec); 67 | #ifdef __WITH_LIBEVENT__ 68 | pTmr = (NwMiniTmrT*) malloc(sizeof(NwMiniTmrT)); 69 | 70 | /* set the timevalues*/ 71 | timerclear(&tv); 72 | tv.tv_sec = timeoutSec; 73 | tv.tv_usec = timeoutUsec; 74 | 75 | pTmr->timeoutArg = timeoutArg; 76 | evtimer_set(&pTmr->ev, nwMiniTmrMgrHandleTimeout, pTmr); 77 | 78 | /*add event*/ 79 | 80 | event_add(&(pTmr->ev), &tv); 81 | #else 82 | #warning "Timer library not defined!" 83 | #endif 84 | 85 | *hTmr = (NwSdpTimerHandleT)pTmr; 86 | 87 | return rc; 88 | } 89 | 90 | NwSdpRcT nwTimerStop( NwSdpTimerMgrHandleT tmrMgrHandle, 91 | NwSdpTimerHandleT hTmr) 92 | { 93 | NW_LOG(NW_LOG_LEVEL_INFO, "Received stop timer request from stack for timer handle %u", hTmr); 94 | #ifdef __WITH_LIBEVENT__ 95 | evtimer_del(&(((NwMiniTmrT*)hTmr)->ev)); 96 | free((void*)hTmr); 97 | #else 98 | #warning "Timer library not defined!" 99 | #endif 100 | return NW_SDP_OK; 101 | } 102 | 103 | #ifdef __cplusplus 104 | } 105 | #endif 106 | -------------------------------------------------------------------------------- /nw-sdp/test-app/nw-helloworld/NwMiniTmrMgrEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C T M R M G R E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | 10 | /** 11 | * @file NwMiniTmrMgrEntity.c 12 | * @brief This file ontains example of a minimalistic timer manager entity. 13 | */ 14 | 15 | #include 16 | #include 17 | #include "NwEvt.h" 18 | #include "NwLog.h" 19 | 20 | #ifndef NW_ASSERT 21 | #define NW_ASSERT assert 22 | #endif 23 | 24 | #ifndef __NW_MINI_TMR_MGR_H__ 25 | #define __NW_MINI_TMR_MGR_H__ 26 | 27 | typedef struct 28 | { 29 | NwEventT ev; 30 | void* timeoutArg; 31 | } NwMiniTmrT; 32 | 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | NwSdpRcT nwTimerStart( NwSdpTimerMgrHandleT tmrMgrHandle, 39 | NwU32T timeoutSec, 40 | NwU32T timeoutUsec, 41 | NwU32T tmrType, 42 | void* timeoutArg, 43 | NwSdpTimerHandleT* hTmr); 44 | 45 | 46 | NwSdpRcT nwTimerStop( NwSdpTimerMgrHandleT tmrMgrHandle, 47 | NwSdpTimerHandleT hTmr); 48 | 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /nw-sdp/test-app/nw-helloworld/NwMiniUdpEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C U D P E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | 10 | /** 11 | * @file NwMiniUdpEntity.h 12 | * @brief This file contains example of a minimalistic ULP entity. 13 | */ 14 | 15 | #include 16 | #include 17 | #include "NwEvt.h" 18 | #include "NwLog.h" 19 | 20 | #ifndef NW_ASSERT 21 | #define NW_ASSERT assert 22 | #endif 23 | 24 | #ifndef __NW_MINI_UDP_ENTITY_H__ 25 | #define __NW_MINI_UDP_ENTITY_H__ 26 | 27 | typedef struct 28 | { 29 | NwU32T hSocket; 30 | NwEventT ev; 31 | NwSdpHandleT hSdp; 32 | } NwMiniUdpEntityT; 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | NwSdpRcT nwMiniUdpInit(NwMiniUdpEntityT* thiz, NwSdpHandleT hSdp, NwU8T* ipAddr); 39 | 40 | NwSdpRcT nwMiniUdpDestroy(NwMiniUdpEntityT* thiz); 41 | 42 | NwSdpRcT 43 | nwMiniUdpCreateGreInterface(NwMiniUdpEntityT* thiz, char* localIpStr, NwU32T* phGreInterface); 44 | 45 | NwSdpRcT nwMiniUdpGreDataReq(NwU32T hGreInterface, 46 | NwU8T* dataBuf, 47 | NwU32T dataSize, 48 | NwU32T peerAddr, 49 | NwU32T peerPort); 50 | 51 | NwSdpRcT nwMiniUdpDataReq(NwSdpUdpHandleT udpHandle, 52 | NwU8T* dataBuf, 53 | NwU32T dataSize, 54 | NwU32T peerAddr, 55 | NwU32T peerPort); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /nw-sdp/test-app/nw-helloworld/NwMiniUlpEntity.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * M I N I M A L I S T I C U L P E N T I T Y * 4 | * * 5 | * Copyright (C) 2010 Amit Chawre. * 6 | * * 7 | *----------------------------------------------------------------------------*/ 8 | 9 | /** 10 | * @file NwMiniUlpEntity.h 11 | * @brief This file contains example of a minimalistic ULP entity. 12 | */ 13 | 14 | #include 15 | #include 16 | #include "NwEvt.h" 17 | #include "NwLog.h" 18 | 19 | #ifndef __NW_MINI_ULP_H__ 20 | #define __NW_MINI_ULP_H__ 21 | 22 | typedef struct 23 | { 24 | int greSd; 25 | NwU16T seqNum; 26 | NwU8T restartCounter; 27 | NwU8T localIpStr[16]; 28 | NwU8T peerIpStr[16]; 29 | NwU32T localPort[1025]; 30 | NwEventT greEv; 31 | NwEventT ev[1025]; 32 | NwSdpHandleT hSdp; 33 | NwSdpSessionHandleT hGtpv1uConn; 34 | } NwMiniUlpEntityT; 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | NwSdpRcT 41 | nwMiniUlpInit(NwMiniUlpEntityT* thiz, NwSdpHandleT hSdp); 42 | 43 | NwSdpRcT 44 | nwMiniUlpDestroy(NwMiniUlpEntityT* thiz); 45 | 46 | NwSdpRcT 47 | nwMiniUlpCreateConn(NwMiniUlpEntityT* thiz, char* localIpStr, NwU16T localPort, char* peerIpStr); 48 | 49 | NwSdpRcT 50 | nwMiniUlpDestroyConn(NwMiniUlpEntityT* thiz); 51 | 52 | NwSdpRcT 53 | nwMiniUlpSendMsg(NwMiniUlpEntityT* thiz); 54 | 55 | NwSdpRcT 56 | nwMiniUlpTpduSend(NwMiniUlpEntityT* thiz, NwU8T* tpduBuf, NwU32T tpduLen , NwU16T fromPort); 57 | 58 | NwSdpRcT 59 | nwMiniUlpProcessStackReqCallback (NwSdpUlpHandleT hUlp, 60 | NwSdpUlpApiT *pUlpApi); 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /utils/nw-gtpu-if/NwGtpv1uIf.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "NwEvt.h" 12 | #include "NwUtils.h" 13 | #include "NwLog.h" 14 | #include "NwGtpv1u.h" 15 | #include "NwGtpv1uIf.h" 16 | #include "NwGtpv1uIfLog.h" 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /*--------------------------------------------------------------------------- 23 | * U D P E N T I T Y 24 | *--------------------------------------------------------------------------*/ 25 | 26 | NwRcT nwGtpv1uIfInitialize(NwGtpv1uIfT* thiz, NwU32T ipAddr, NwSdpHandleT hSdp) 27 | { 28 | int sd; 29 | struct sockaddr_in addr; 30 | 31 | sd = socket(AF_INET, SOCK_DGRAM, 0); 32 | 33 | if (sd < 0) 34 | { 35 | NW_GTPV1U_IF_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); 36 | NW_ASSERT(0); 37 | } 38 | 39 | addr.sin_family = AF_INET; 40 | addr.sin_port = htons(NW_GTPU_UDP_PORT); 41 | addr.sin_addr.s_addr = htonl(ipAddr); 42 | memset(addr.sin_zero, '\0', sizeof (addr.sin_zero)); 43 | 44 | if(bind(sd, (struct sockaddr *)&addr, sizeof(addr)) < 0) 45 | { 46 | NW_GTPV1U_IF_LOG(NW_LOG_LEVEL_ERRO, "Bind error for %x:%u - %s", ipAddr, NW_GTPU_UDP_PORT, strerror(errno)); 47 | NW_ASSERT(0); 48 | } 49 | 50 | thiz->hSocket = sd; 51 | thiz->hSdp = hSdp; 52 | thiz->ipAddr = ipAddr; 53 | 54 | return NW_OK; 55 | } 56 | 57 | NwRcT nwGtpv1uIfGetSelectionObject(NwGtpv1uIfT* thiz, NwU32T *pSelObj) 58 | { 59 | *pSelObj = thiz->hSocket; 60 | return NW_OK; 61 | } 62 | 63 | void NW_EVT_CALLBACK(nwGtpv1uIfDataIndicationCallback) 64 | { 65 | NwRcT rc; 66 | NwU8T udpBuf[MAX_GTPU_PAYLOAD_LEN]; 67 | NwU32T bytesRead; 68 | NwU32T peerLen; 69 | struct sockaddr_in peer; 70 | NwGtpv1uIfT* thiz = (NwGtpv1uIfT*) arg; 71 | 72 | peerLen = sizeof(peer); 73 | 74 | bytesRead = recvfrom(thiz->hSocket, udpBuf, MAX_GTPU_PAYLOAD_LEN , 0, (struct sockaddr *) &peer,(socklen_t*) &peerLen); 75 | if(bytesRead) 76 | { 77 | NW_GTPV1U_IF_LOG(NW_LOG_LEVEL_DEBG, "Received GTPU message of length %u from "NW_IPV4_ADDR":%u", bytesRead, NW_IPV4_ADDR_FORMAT((peer.sin_addr.s_addr)), ntohs(peer.sin_port)); 78 | nwLogHexDump(udpBuf, bytesRead); 79 | 80 | rc = nwSdpProcessGtpuDataInd(thiz->hSdp, udpBuf, bytesRead, ntohs(peer.sin_port), ntohl(peer.sin_addr.s_addr)); 81 | } 82 | else 83 | { 84 | NW_GTPV1U_IF_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); 85 | } 86 | } 87 | 88 | NwRcT nwGtpv1uIfDataReq(NwGtpv1uUdpHandleT udpHandle, 89 | NwU8T* dataBuf, 90 | NwU32T dataSize, 91 | NwU32T peerIpAddr, 92 | NwU32T peerPort) 93 | { 94 | struct sockaddr_in peerAddr; 95 | NwS32T bytesSent; 96 | NwGtpv1uIfT* thiz = (NwGtpv1uIfT*) udpHandle; 97 | 98 | NW_GTPV1U_IF_LOG(NW_LOG_LEVEL_DEBG, "Sending buf of size %u for on handle %x to peer "NW_IPV4_ADDR, dataSize, udpHandle, 99 | NW_IPV4_ADDR_FORMAT(ntohl(peerIpAddr))); 100 | 101 | peerAddr.sin_family = AF_INET; 102 | peerAddr.sin_port = htons(peerPort); 103 | peerAddr.sin_addr.s_addr = htonl(peerIpAddr); 104 | memset(peerAddr.sin_zero, '\0', sizeof (peerAddr.sin_zero)); 105 | 106 | nwLogHexDump(dataBuf, dataSize); 107 | 108 | bytesSent = sendto (thiz->hSocket, dataBuf, dataSize, 0, (struct sockaddr *) &peerAddr, sizeof(peerAddr)); 109 | 110 | if(bytesSent < 0) 111 | { 112 | NW_GTPV1U_IF_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); 113 | NW_ASSERT(0); 114 | } 115 | return NW_OK; 116 | } 117 | 118 | #ifdef __cplusplus 119 | } 120 | #endif 121 | 122 | 123 | -------------------------------------------------------------------------------- /utils/nw-gtpu-if/NwGtpv1uIf.h: -------------------------------------------------------------------------------- 1 | 2 | #include "NwTypes.h" 3 | #include "NwError.h" 4 | #include "NwGtpv1u.h" 5 | #include "NwSdp.h" 6 | #include "NwEvt.h" 7 | #ifndef __NW_GTPV1U_IF_H__ 8 | #define __NW_GTPV1U_IF_H__ 9 | 10 | /*--------------------------------------------------------------------------- 11 | * U D P E N T I T Y 12 | *--------------------------------------------------------------------------*/ 13 | 14 | #define NW_GTPU_UDP_PORT (2152) 15 | #define MAX_GTPU_PAYLOAD_LEN (4096) 16 | 17 | typedef struct 18 | { 19 | NwU32T hSocket; 20 | NwU32T ipAddr; 21 | NwEventT ev; 22 | NwSdpHandleT hSdp; 23 | } NwGtpv1uIfT; 24 | 25 | 26 | NwRcT nwGtpv1uIfInitialize(NwGtpv1uIfT* thiz, NwU32T ipAddr, NwSdpHandleT hSdp); 27 | NwRcT nwGtpv1uIfDestroy(NwGtpv1uIfT* thiz); 28 | 29 | NwRcT nwGtpv1uIfGetSelectionObject(NwGtpv1uIfT* thiz, NwU32T *pSelObj); 30 | 31 | void NW_EVT_CALLBACK(nwGtpv1uIfDataIndicationCallback); 32 | 33 | NwRcT nwGtpv1uIfDataReq(NwGtpv1uUdpHandleT udpHandle, 34 | NwU8T* dataBuf, 35 | NwU32T dataSize, 36 | NwU32T peerIpAddr, 37 | NwU32T peerIpPort); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /utils/nw-gtpv2c-if/NwGtpv2cIf.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "NwEvt.h" 11 | #include "NwUtils.h" 12 | #include "NwLog.h" 13 | #include "NwGtpv2cIf.h" 14 | #include "NwGtpv2cIfLog.h" 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /*--------------------------------------------------------------------------- 21 | * U D P E N T I T Y 22 | *--------------------------------------------------------------------------*/ 23 | 24 | 25 | NwRcT nwGtpv2cIfInitialize(NwGtpv2cIfT* thiz, NwU32T ipAddr, NwGtpv2cStackHandleT hGtpcStack) 26 | { 27 | int sd; 28 | struct sockaddr_in addr; 29 | 30 | sd = socket(AF_INET, SOCK_DGRAM, 0); 31 | 32 | if (sd < 0) 33 | { 34 | NW_GTPV2C_IF_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); 35 | NW_ASSERT(0); 36 | } 37 | 38 | addr.sin_family = AF_INET; 39 | addr.sin_port = htons(NW_GTPC_UDP_PORT); 40 | addr.sin_addr.s_addr = htonl(ipAddr); 41 | memset(addr.sin_zero, '\0', sizeof (addr.sin_zero)); 42 | 43 | if(bind(sd, (struct sockaddr *)&addr, sizeof(addr)) < 0) 44 | { 45 | NW_GTPV2C_IF_LOG(NW_LOG_LEVEL_ERRO, "Bind error for %x:%u - %s", ipAddr, NW_GTPC_UDP_PORT, strerror(errno)); 46 | NW_ASSERT(0); 47 | } 48 | 49 | thiz->hSocket = sd; 50 | thiz->hGtpcStack = hGtpcStack; 51 | thiz->ipAddr = ipAddr; 52 | 53 | return NW_OK; 54 | } 55 | 56 | NwRcT nwGtpv2cIfGetSelectionObject(NwGtpv2cIfT* thiz, NwU32T *pSelObj) 57 | { 58 | *pSelObj = thiz->hSocket; 59 | return NW_OK; 60 | } 61 | 62 | void NW_EVT_CALLBACK(nwGtpv2cIfDataIndicationCallback) 63 | { 64 | NwRcT rc; 65 | NwU8T udpBuf[MAX_GTPV2C_PAYLOAD_LEN]; 66 | NwU32T bytesRead; 67 | NwU32T peerLen; 68 | struct sockaddr_in peer; 69 | NwGtpv2cIfT* thiz = (NwGtpv2cIfT*) arg; 70 | 71 | peerLen = sizeof(peer); 72 | 73 | bytesRead = recvfrom(thiz->hSocket, udpBuf, MAX_GTPV2C_PAYLOAD_LEN , 0, (struct sockaddr *) &peer,(socklen_t*) &peerLen); 74 | if(bytesRead) 75 | { 76 | NW_GTPV2C_IF_LOG(NW_LOG_LEVEL_DEBG, "Received GTPCv2 message of length %u from %X:%u", bytesRead, ntohl(peer.sin_addr.s_addr), ntohs(peer.sin_port)); 77 | nwLogHexDump(udpBuf, bytesRead); 78 | 79 | rc = nwGtpv2cProcessUdpReq(thiz->hGtpcStack, udpBuf, bytesRead, ntohs(peer.sin_port), (peer.sin_addr.s_addr)); 80 | } 81 | else 82 | { 83 | NW_GTPV2C_IF_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); 84 | } 85 | } 86 | 87 | NwRcT nwGtpv2cIfDataReq(NwGtpv2cUdpHandleT udpHandle, 88 | NwU8T* dataBuf, 89 | NwU32T dataSize, 90 | NwU32T peerIpAddr, 91 | NwU32T peerPort) 92 | { 93 | struct sockaddr_in peerAddr; 94 | NwS32T bytesSent; 95 | NwGtpv2cIfT* thiz = (NwGtpv2cIfT*) udpHandle; 96 | 97 | NW_GTPV2C_IF_LOG(NW_LOG_LEVEL_DEBG, "Sending buf of size %u for on handle %x to peer "NW_IPV4_ADDR, dataSize, udpHandle, 98 | NW_IPV4_ADDR_FORMAT(peerIpAddr)); 99 | 100 | peerAddr.sin_family = AF_INET; 101 | peerAddr.sin_port = htons(peerPort); 102 | peerAddr.sin_addr.s_addr = (peerIpAddr); 103 | memset(peerAddr.sin_zero, '\0', sizeof (peerAddr.sin_zero)); 104 | 105 | nwLogHexDump(dataBuf, dataSize); 106 | 107 | bytesSent = sendto (thiz->hSocket, dataBuf, dataSize, 0, (struct sockaddr *) &peerAddr, sizeof(peerAddr)); 108 | 109 | if(bytesSent < 0) 110 | { 111 | NW_GTPV2C_IF_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); 112 | NW_ASSERT(0); 113 | } 114 | return NW_OK; 115 | } 116 | #ifdef __cplusplus 117 | } 118 | #endif 119 | 120 | 121 | -------------------------------------------------------------------------------- /utils/nw-gtpv2c-if/NwGtpv2cIf.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __NW_GTPV2C_IF_H__ 3 | #define __NW_GTPV2C_IF_H__ 4 | 5 | #include "NwEvt.h" 6 | #include "NwTypes.h" 7 | #include "NwGtpv2c.h" 8 | 9 | /*--------------------------------------------------------------------------- 10 | * U D P E N T I T Y 11 | *--------------------------------------------------------------------------*/ 12 | 13 | #define NW_GTPC_UDP_PORT (2123) 14 | #define MAX_GTPV2C_PAYLOAD_LEN (4096) 15 | 16 | typedef struct 17 | { 18 | NwU32T hSocket; 19 | NwU32T ipAddr; 20 | NwGtpv2cStackHandleT hGtpcStack; 21 | } NwGtpv2cIfT; 22 | 23 | 24 | NwRcT 25 | nwGtpv2cIfInitialize(NwGtpv2cIfT* thiz, NwU32T ipAddr, NwGtpv2cStackHandleT hGtpcStack); 26 | 27 | NwRcT 28 | nwGtpv2cIfDestroy(NwGtpv2cIfT* thiz); 29 | 30 | NwRcT 31 | nwGtpv2cIfGetSelectionObject(NwGtpv2cIfT* thiz, NwU32T *pSelObj); 32 | 33 | void NW_EVT_CALLBACK(nwGtpv2cIfDataIndicationCallback); 34 | 35 | NwRcT 36 | nwGtpv2cIfDataReq(NwGtpv2cUdpHandleT udpHandle, 37 | NwU8T* dataBuf, 38 | NwU32T dataSize, 39 | NwU32T peerIpAddr, 40 | NwU32T peerIpPort); 41 | 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /utils/nw-ippool/NwIpv4PoolMgr.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * Copyright (c) 2010-2011 Amit Chawre * 4 | * All rights reserved. * 5 | * * 6 | * Redistribution and use in source and binary forms, with or without * 7 | * modification, are permitted provided that the following conditions * 8 | * are met: * 9 | * * 10 | * 1. Redistributions of source code must retain the above copyright * 11 | * notice, this list of conditions and the following disclaimer. * 12 | * 2. Redistributions in binary form must reproduce the above copyright * 13 | * notice, this list of conditions and the following disclaimer in the * 14 | * documentation and/or other materials provided with the distribution. * 15 | * 3. The name of the author may not be used to endorse or promote products * 16 | * derived from this software without specific prior written permission. * 17 | * * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 28 | *----------------------------------------------------------------------------*/ 29 | 30 | 31 | #include "NwTypes.h" 32 | #include "NwError.h" 33 | 34 | #ifndef __NW_IPV4_POOL_MGR_H__ 35 | #define __NW_IPV4_POOL_MGR_H__ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | typedef NwPtrT NwIpv4PoolMgrHandleT; 42 | 43 | NwIpv4PoolMgrHandleT 44 | nwIpv4PoolMgrNew(NwU32T startIp, NwU32T endIp, NwU32T mask); 45 | 46 | NwRcT 47 | nwIpv4PoolMgrDelete(NwIpv4PoolMgrHandleT hIpv4PoolMgr); 48 | 49 | NwRcT 50 | nwIpv4PoolMgrAlloc(NwIpv4PoolMgrHandleT hIpv4PoolMgr, NwU32T* pIpv4Addr); 51 | 52 | NwRcT 53 | nwIpv4PoolMgrFree(NwIpv4PoolMgrHandleT hIpv4PoolMgr, NwU32T ipv4Addr); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /utils/nw-log/NwLogMgr.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * Copyright (c) 2010-2011 Amit Chawre * 4 | * All rights reserved. * 5 | * * 6 | * Redistribution and use in source and binary forms, with or without * 7 | * modification, are permitted provided that the following conditions * 8 | * are met: * 9 | * * 10 | * 1. Redistributions of source code must retain the above copyright * 11 | * notice, this list of conditions and the following disclaimer. * 12 | * 2. Redistributions in binary form must reproduce the above copyright * 13 | * notice, this list of conditions and the following disclaimer in the * 14 | * documentation and/or other materials provided with the distribution. * 15 | * 3. The name of the author may not be used to endorse or promote products * 16 | * derived from this software without specific prior written permission. * 17 | * * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 28 | *----------------------------------------------------------------------------*/ 29 | 30 | /** 31 | * @file NwLog.h 32 | * @brief This file defines log manager entity. 33 | */ 34 | 35 | #include 36 | 37 | #include "NwTypes.h" 38 | #include "NwError.h" 39 | #include "NwLog.h" 40 | 41 | #ifndef __NW_LOG_MGR_H__ 42 | #define __NW_LOG_MGR_H__ 43 | 44 | typedef struct 45 | { 46 | NwU8T compName[32]; 47 | NwU32T compInst; 48 | NwU32T logLevel; 49 | NwU8T logDir[32]; 50 | FILE* fp; /* Log File Pointer */ 51 | } NwLogMgrT; 52 | 53 | extern NwLogMgrT _gLogMgr; 54 | 55 | extern NwLogMgrT* 56 | nwLogMgrGetInstance(); 57 | 58 | extern NwRcT 59 | nwLogMgrInit(NwLogMgrT* thiz, NwU8T* strCompName, NwU32T compInst); 60 | 61 | extern NwRcT 62 | nwLogMgrGetLogLevel(NwLogMgrT* thiz); 63 | 64 | extern NwRcT 65 | nwLogHexDump(NwU8T* data, NwU32T size); 66 | 67 | extern NwRcT 68 | nwLogMgrLog(NwLogMgrT* thiz, 69 | NwCharT* logModuleStr, 70 | NwU8T logLevel, 71 | NwCharT* fileNameStr, 72 | NwU32T line, 73 | NwCharT* logStr); 74 | #endif 75 | -------------------------------------------------------------------------------- /utils/nw-tmr/NwTmrMgr.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * Copyright (c) 2010-2011 Amit Chawre * 4 | * All rights reserved. * 5 | * * 6 | * Redistribution and use in source and binary forms, with or without * 7 | * modification, are permitted provided that the following conditions * 8 | * are met: * 9 | * * 10 | * 1. Redistributions of source code must retain the above copyright * 11 | * notice, this list of conditions and the following disclaimer. * 12 | * 2. Redistributions in binary form must reproduce the above copyright * 13 | * notice, this list of conditions and the following disclaimer in the * 14 | * documentation and/or other materials provided with the distribution. * 15 | * 3. The name of the author may not be used to endorse or promote products * 16 | * derived from this software without specific prior written permission. * 17 | * * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 28 | *----------------------------------------------------------------------------*/ 29 | 30 | /** 31 | * @file NwTmr.h 32 | * @brief 33 | */ 34 | 35 | #include 36 | 37 | #include "NwEvt.h" 38 | #include "NwTypes.h" 39 | #include "NwError.h" 40 | #include "NwLog.h" 41 | 42 | #ifndef __NW_TMR_MGR_H__ 43 | #define __NW_TMR_MGR_H__ 44 | 45 | 46 | typedef NwPtrT NwTimerHandleT; 47 | typedef NwPtrT NwTimerMgrHandleT; 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | #define NW_TIMER_TYPE_ONE_SHOT (0) 54 | #define NW_TIMER_TYPE_REPETITIVE (1) 55 | 56 | extern NwRcT 57 | nwTmrMgrInitialize( NwTimerMgrHandleT *tmrMgrHandle); 58 | 59 | extern NwRcT 60 | nwTmrMgrFinalize( NwTimerMgrHandleT tmrMgrHandle); 61 | 62 | extern NwRcT 63 | nwTmrMgrStartTimer( NwTimerMgrHandleT tmrMgrHandle, 64 | NwU32T timeoutSec, 65 | NwU32T timeoutUsec, 66 | NwU32T tmrType, 67 | void NW_TMR_CALLBACK((*nwTimerTimeout)), 68 | void* timeoutArg, 69 | NwTimerHandleT* phTmr); 70 | 71 | extern NwRcT 72 | nwTmrMgrStopTimer( NwTimerMgrHandleT tmrMgrHandle, 73 | NwTimerHandleT hTmr); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /utils/nw-udp/NwUdp.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "NwEvt.h" 12 | #include "NwUtils.h" 13 | #include "NwLog.h" 14 | #include "NwUdp.h" 15 | #include "NwUdpLog.h" 16 | 17 | /*--------------------------------------------------------------------------- 18 | * U D P E N T I T Y 19 | *--------------------------------------------------------------------------*/ 20 | 21 | static void NW_EVT_CALLBACK(nwUdpDataIndicationCallbackData) 22 | { 23 | NwRcT rc; 24 | NwU8T udpBuf[MAX_UDP_PAYLOAD_LEN]; 25 | NwU32T bytesRead; 26 | NwU32T peerLen; 27 | struct sockaddr_in peer; 28 | NwUdpT* thiz = (NwUdpT*) arg; 29 | 30 | peerLen = sizeof(peer); 31 | 32 | bytesRead = recvfrom(thiz->hSocket, udpBuf, MAX_UDP_PAYLOAD_LEN , 0, (struct sockaddr *) &peer,(socklen_t*) &peerLen); 33 | if(bytesRead) 34 | { 35 | NW_UDP_LOG(NW_LOG_LEVEL_DEBG, "Received UDP message of length %u from %X:%u", bytesRead, ntohl(peer.sin_addr.s_addr), ntohs(peer.sin_port)); 36 | nwLogHexDump(udpBuf, bytesRead); 37 | 38 | rc = nwGtpv2cProcessUdpReq(thiz->hGtpcStack, udpBuf, bytesRead, ntohs(peer.sin_port), (peer.sin_addr.s_addr)); 39 | } 40 | else 41 | { 42 | NW_UDP_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); 43 | } 44 | } 45 | 46 | NwRcT nwUdpDataReq(NwGtpv2cUdpHandleT udpHandle, 47 | NwU8T* dataBuf, 48 | NwU32T dataSize, 49 | NwU32T peerIpAddr, 50 | NwU32T peerPort) 51 | { 52 | struct sockaddr_in peerAddr; 53 | NwS32T bytesSent; 54 | NwUdpT* thiz = (NwUdpT*) udpHandle; 55 | 56 | NW_UDP_LOG(NW_LOG_LEVEL_DEBG, "Sending buf of size %u for on handle %x to peer %u.%u.%u.%u:%u", dataSize, udpHandle, 57 | (peerIpAddr & 0x000000ff), 58 | (peerIpAddr & 0x0000ff00) >> 8, 59 | (peerIpAddr & 0x00ff0000) >> 16, 60 | (peerIpAddr & 0xff000000) >> 24, 61 | peerPort); 62 | 63 | peerAddr.sin_family = AF_INET; 64 | peerAddr.sin_port = htons(peerPort); 65 | peerAddr.sin_addr.s_addr = (peerIpAddr); 66 | memset(peerAddr.sin_zero, '\0', sizeof (peerAddr.sin_zero)); 67 | 68 | nwLogHexDump(dataBuf, dataSize); 69 | 70 | bytesSent = sendto (thiz->hSocket, dataBuf, dataSize, 0, (struct sockaddr *) &peerAddr, sizeof(peerAddr)); 71 | 72 | if(bytesSent < 0) 73 | { 74 | NW_UDP_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); 75 | NW_ASSERT(0); 76 | } 77 | return NW_OK; 78 | } 79 | 80 | NwRcT nwUdpInit(NwUdpT* thiz, NwU32T ipAddr, NwGtpv2cStackHandleT hGtpcStack) 81 | { 82 | int sd; 83 | struct sockaddr_in addr; 84 | 85 | sd = socket(AF_INET, SOCK_DGRAM, 0); 86 | 87 | if (sd < 0) 88 | { 89 | NW_UDP_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); 90 | NW_ASSERT(0); 91 | } 92 | 93 | addr.sin_family = AF_INET; 94 | addr.sin_port = htons(NW_GTPC_UDP_PORT); 95 | addr.sin_addr.s_addr = (ipAddr); 96 | memset(addr.sin_zero, '\0', sizeof (addr.sin_zero)); 97 | 98 | if(bind(sd, (struct sockaddr *)&addr, sizeof(addr)) < 0) 99 | { 100 | NW_UDP_LOG(NW_LOG_LEVEL_ERRO, "Bind error for %x:%u - %s", ipAddr, NW_GTPC_UDP_PORT, strerror(errno)); 101 | NW_ASSERT(0); 102 | } 103 | 104 | NW_EVENT_ADD((thiz->ev), sd, nwUdpDataIndicationCallbackData, thiz, NW_EVT_READ | NW_EVT_PERSIST); 105 | 106 | thiz->hSocket = sd; 107 | thiz->hGtpcStack = hGtpcStack; 108 | thiz->ipAddr = ipAddr; 109 | 110 | return NW_OK; 111 | } 112 | 113 | 114 | -------------------------------------------------------------------------------- /utils/nw-udp/NwUdp.h: -------------------------------------------------------------------------------- 1 | 2 | #include "NwEvt.h" 3 | #include "NwTypes.h" 4 | #include "NwGtpv2c.h" 5 | 6 | #ifndef __NW_UDP_H__ 7 | #define __NW_UDP_H__ 8 | 9 | /*--------------------------------------------------------------------------- 10 | * U D P E N T I T Y 11 | *--------------------------------------------------------------------------*/ 12 | 13 | #define NW_GTPC_UDP_PORT (2123) 14 | #define MAX_UDP_PAYLOAD_LEN (4096) 15 | 16 | typedef struct 17 | { 18 | NwU32T hSocket; 19 | NwU32T ipAddr; 20 | NwEventT ev; 21 | NwGtpv2cStackHandleT hGtpcStack; 22 | } NwUdpT; 23 | 24 | 25 | NwRcT 26 | nwUdpDataReq(NwGtpv2cUdpHandleT udpHandle, 27 | NwU8T* dataBuf, 28 | NwU32T dataSize, 29 | NwU32T peerIpAddr, 30 | NwU32T peerIpPort); 31 | 32 | NwRcT nwUdpInit(NwUdpT* thiz, NwU32T ipAddr, NwGtpv2cStackHandleT hGtpcStack); 33 | NwRcT nwUdpDestroy(NwUdpT* thiz); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /utils/nw-udp/NwUdpLog.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------* 2 | * * 3 | * Copyright (c) 2010-2011 Amit Chawre * 4 | * All rights reserved. * 5 | * * 6 | * Redistribution and use in source and binary forms, with or without * 7 | * modification, are permitted provided that the following conditions * 8 | * are met: * 9 | * * 10 | * 1. Redistributions of source code must retain the above copyright * 11 | * notice, this list of conditions and the following disclaimer. * 12 | * 2. Redistributions in binary form must reproduce the above copyright * 13 | * notice, this list of conditions and the following disclaimer in the * 14 | * documentation and/or other materials provided with the distribution. * 15 | * 3. The name of the author may not be used to endorse or promote products * 16 | * derived from this software without specific prior written permission. * 17 | * * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 28 | *----------------------------------------------------------------------------*/ 29 | 30 | /** 31 | * @file NwUdpLog.h 32 | * @brief This files defines UDP entity. 33 | */ 34 | 35 | #include 36 | #include "NwTypes.h" 37 | #include "NwLog.h" 38 | #include "NwLogMgr.h" 39 | 40 | #ifndef __NW_UDP_LOG_H__ 41 | #define __NW_UDP_LOG_H__ 42 | 43 | #define NW_UDP_LOG( _logLevel, ...) \ 44 | do { \ 45 | char _logStr[1024]; \ 46 | if(_gLogMgr.logLevel >= _logLevel) \ 47 | { \ 48 | snprintf(_logStr, 1024, __VA_ARGS__); \ 49 | nwLogMgrLog(&_gLogMgr, " NW-UDP ", _logLevel, (char*)basename(__FILE__), __LINE__, _logStr);\ 50 | } \ 51 | } while(0) 52 | 53 | #define NW_UDP_ENTER() \ 54 | do { \ 55 | NW_UDP_LOG(NW_LOG_LEVEL_DEBG, "Entering '%s'", __func__); \ 56 | } while(0) 57 | 58 | #define NW_UDP_LEAVE() \ 59 | do { \ 60 | NW_UDP_LOG(NW_LOG_LEVEL_DEBG, "Leaving '%s'", __func__); \ 61 | } while(0) 62 | 63 | #endif 64 | --------------------------------------------------------------------------------