Commit 6b21dea1 authored by Robert Schmidt's avatar Robert Schmidt

Remove legacy 4G kernel modules

I don't know about any user of the kernel modules. It is effectively
legacy code we carry around, for no good reason. Remove it for the
moment. If we ever need it, we can revert.
parent 8f549a54
......@@ -508,9 +508,6 @@ include_directories ("${OPENAIR_DIR}/radio/COMMON")
# ???!!! TO BE DOCUMENTED OPTIONS !!!???
##############################################################
add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????" ON)
add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????" ON)
add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION with max 256 UE" ON)
add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION with max 256 UE" ON)
add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE" ON)
......@@ -2331,7 +2328,7 @@ endforeach(myExe)
#ensure that the T header files are generated before targets depending on them
if (${T_TRACER})
foreach(i
#all "add_executable" definitions (except tests, rb_tool, updatefw)
#all "add_executable" definitions (except tests, updatefw)
lte-softmodem lte-uesoftmodem nr-softmodem
nr-uesoftmodem dlsim dlsim_tm4 dlsim_tm7
ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim
......@@ -2354,85 +2351,6 @@ if (${T_TRACER})
endforeach(i)
endif (${T_TRACER})
##################################################
# Generated specific cases is not regular code
###############################################
################
# Kernel modules
###############
# Set compiler options for kernel modules
# we need to get out cmake to use the regular Linux Kernel process
# this is documented as https://www.kernel.org/doc/Documentation/kbuild/modules.txt
######################################
# retrieve the compiler options to send it to gccxml
get_directory_property(DirDefs COMPILE_DEFINITIONS )
foreach( d ${DirDefs} )
set(module_cc_opt "${module_cc_opt} -D${d}")
endforeach()
get_directory_property( DirDefs INCLUDE_DIRECTORIES )
foreach( d ${DirDefs} )
set(module_cc_opt "${module_cc_opt} -I${d}")
endforeach()
EXECUTE_PROCESS(COMMAND uname -r
OUTPUT_VARIABLE os_release
OUTPUT_STRIP_TRAILING_WHITESPACE)
SET(module_build_path /lib/modules/${os_release}/build)
function(make_driver name dir)
file(MAKE_DIRECTORY ${OPENAIR_BIN_DIR}/${name})
foreach(f IN ITEMS ${ARGN})
list(APPEND src_path_list ${dir}/${f})
string(REGEX REPLACE "c *$" "o" obj ${f})
set(objs "${objs} ${obj}")
endforeach()
CONFIGURE_FILE(${OPENAIR_CMAKE}/tools/Kbuild.cmake ${OPENAIR_BIN_DIR}/${name}/Kbuild)
add_custom_command(OUTPUT ${name}.ko
COMMAND make -C ${module_build_path} M=${OPENAIR_BIN_DIR}/${name}
WORKING_DIRECTORY ${OPENAIR_BIN_DIR}/${name}
COMMENT "building ${module}.ko"
VERBATIM
SOURCES ${src_path_list}
)
add_custom_target(${name} DEPENDS ${name}.ko)
endfunction(make_driver name dir src)
# nashmesh module
################
list(APPEND nasmesh_src device.c common.c ioctl.c classifier.c tool.c mesh.c)
# legacy Makefile was using NAS_NETLINK flag, but other drivers the hereafter flag
# so, this cmake use OAI_NW_DRIVER_USE_NETLINK everywhere
if (OAI_NW_DRIVER_USE_NETLINK)
list(APPEND nasmesh_src netlink.c)
endif()
make_driver(nasmesh ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH ${nasmesh_src})
# user space tool for configuring MESH IP driver
################
add_executable(rb_tool
${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/RB_TOOL/rb_tool.c
)
target_include_directories(rb_tool PRIVATE ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/)
# ???
####################
list(APPEND oai_nw_drv_src device.c common.c ioctl.c classifier.c tool.c)
if(OAI_NW_DRIVER_USE_NETLINK)
list(APPEND oai_nw_drv_src netlink.c)
endif()
make_driver(oai_nw_drv ${OPENAIR2_DIR}/NETWORK_DRIVER/LTE ${oai_nw_drv_src})
# ue_ip: purpose ???
###############
list(APPEND ue_ip_src device.c common.c)
if(OAI_NW_DRIVER_USE_NETLINK)
list(APPEND ue_ip_src netlink.c)
endif()
make_driver(ue_ip ${OPENAIR2_DIR}/NETWORK_DRIVER/UE_IP ${ue_ip_src})
include(${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/CMakeLists.txt)
set(ENABLE_TESTS OFF CACHE STRING "Activate build of tests")
......
......@@ -85,7 +85,7 @@ Options:
--RU
Makes the OAI RRU
--UE
Makes the UE specific parts (ue_ip, usim, nvram) from the given configuration file
Makes the UE specific parts (usim, nvram) from the given configuration file
--nrUE
Makes the NR UE softmodem
--UE-conf-nvram [configuration file]
......@@ -271,9 +271,6 @@ function main() {
--UE-gen-nvram)
gen_nvram_path=$(readlink -f "$2")
shift 2;;
--UE-ip)
TARGET_LIST="$TARGET_LIST ue_ip"
shift;;
-w | --hardware)
case "$2" in
"USRP" | "BLADERF" | "LMSSDR" | "IRIS")
......
......@@ -171,10 +171,6 @@ clean_kernel() {
$SUDO iptables -t filter -F
$SUDO iptables -t raw -F
echo_info "Flushed iptables"
$SUDO rmmod nasmesh > /dev/null 2>&1
$SUDO rmmod oai_nw_drv > /dev/null 2>&1
$SUDO rmmod ue_ip > /dev/null 2>&1
echo_info "removed drivers from kernel"
}
clean_all_files() {
......
#!/bin/bash
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# file init_nas_nos1
# brief loads the nasmesh module and sets up the radio bearers (used to provide ip interface without S1 interface)
# author Florian Kaltenberger
#
#######################################
load_module() {
mod_name=${1##*/}
mod_name=${mod_name%.*}
if awk "/$mod_name/ {found=1 ;exit} END {if (found!=1) exit 1}" /proc/modules
then
echo "module $mod_name already loaded: I remove it first"
sudo rmmod $mod_name
fi
echo loading $mod_name
sudo insmod $1
}
load_module $OPENAIR_DIR/cmake_targets/ran_build/build/nasmesh.ko
if [ "$1" = "eNB" ]; then
echo "bring up oai0 interface for enb"
sudo ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
$OPENAIR_DIR/cmake_targets/ran_build/build/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.2 -r 1
else
if [ "$1" = "UE" ]; then
echo "bring up oai0 interface for UE"
sudo ifconfig oai0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255
$OPENAIR_DIR/cmake_targets/ran_build/build/rb_tool -a -c0 -i0 -z0 -s 10.0.1.2 -t 10.0.1.1 -r 1
fi
fi
#!/bin/bash
#WARNING: this file may not work properly, be sure to know what you
#do when using it
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
################################################################################
# file init_nas_s1
# brief loads the ue_ip module and sets up IP for the UE
# you may want to edit it to fit your settings (replace oip0 by oipX for
# instance)
# author Florian Kaltenberger
#
#######################################
LTEIF=oip1
#OPENAIR_DIR=/home/oai/svn-oai/openair4G
load_module() {
mod_name=${1##*/}
mod_name=${mod_name%.*}
if awk "/$mod_name/ {found=1 ;exit} END {if (found!=1) exit 1}" /proc/modules
then
echo "module $mod_name already loaded: I remove it first"
sudo rmmod $mod_name
fi
echo loading $mod_name
sudo insmod $1
}
load_module ../ran_build/build/ue_ip.ko
if [ "$1" = "UE" ]; then
echo "bring up $LTEIF interface for UE"
sudo ifconfig $LTEIF up
fi
sudo ip route flush cache
sleep 1
sudo sysctl -w net.ipv4.conf.all.log_martians=1
echo "Disabling reverse path filtering"
sudo sysctl -w net.ipv4.conf.all.rp_filter=0
sudo ip route flush cache
# Check table 200 lte in /etc/iproute2/rt_tables
fgrep lte /etc/iproute2/rt_tables > /dev/null
if [ $? -ne 0 ]; then
echo "200 lte " >> /etc/iproute2/rt_tables
fi
sudo ip rule add fwmark 1 table lte
sudo ip route add default dev $LTEIF table lte
......@@ -38,7 +38,6 @@ Running the [build_oai](../cmake_targets/build_oai) script also generates some
- `conf2uedata`: a binary used to build the (4G) UE data from a configuration file. The created file emulates the sim card of a 3GPP compliant phone.
- `nvram`: a binary used to build (4G) UE (IMEI...) and EMM (IMSI, registered PLMN) non volatile data.
- `rb_tool`: radio bearer utility for (4G) UE
- `genids` T Tracer utility, used at build time to generate `T_IDs.h` include file. This binary is located in the [T Tracer source file directory](../common/utils/T) .
The build system for OAI uses [cmake](https://cmake.org/) which is a tool to generate makefiles. The `build_oai` script is a wrapper using `cmake` and `make`/`ninja` to ease the oai build and use. It logs the `cmake` and `ninja`/`make` commands it executes. The file describing how to build the executables from source files is the [CMakeLists.txt](../CMakeLists.txt), it is used as input by cmake to generate the makefiles.
......
......@@ -49,7 +49,6 @@ extern int otg_enabled;
#include "../MAC/mac_extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "NETWORK_DRIVER/LITE/constant.h"
//#include "SIMULATION/ETH_TRANSPORT/extern.h"
#include "common/utils/LOG/log.h"
#include "UTIL/OTG/otg_tx.h"
......@@ -63,7 +62,6 @@ extern int otg_enabled;
#include <sys/socket.h>
#include <linux/netlink.h>
#include "NETWORK_DRIVER/UE_IP/constant.h"
extern char nl_rx_buf[NL_MAX_PAYLOAD];
extern struct sockaddr_nl nas_src_addr, nas_dest_addr;
......@@ -521,7 +519,7 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx
ctxt.rntiMaybeUEid = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
if (rab_id != 0) {
if (rab_id == UE_IP_DEFAULT_RAB_ID) {
if (rab_id == 1) {
LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%lx, enb_flag=%d)\n", ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag);
key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag);
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
......@@ -695,7 +693,7 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
//UE
if (!ctxt.enb_flag) {
if (rab_id != 0) {
if (rab_id == UE_IP_DEFAULT_RAB_ID) {
if (rab_id == 1) {
LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%lx, enb_flag=%d)\n", ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag);
key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rntiMaybeUEid, ctxt.enb_flag);
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
......
CC = gcc
NAS_DIR = ..
rb_tool: rb_tool.c
$(CC) rb_tool.c -o rb_tool -I../ -g -ggdb
all: rb_tool
clean:
rm rb_tool
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file classifier.c
* \brief Classify IP packets
* \author Navid Nikaein, Lionel GAUTHIER, Raymond knopp
* \company Eurecom
* \email: navid.nikaein@eurecom.fr, lionel.gauthier@eurecom.fr, knopp@eurecom.fr
*/
#include "local.h"
#include "proto_extern.h"
#include <net/ip6_fib.h>
#include <net/route.h>
#ifdef MPLS
#include <net/mpls.h>
#endif
#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0)
#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000)
#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000)
#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000)
#define IN_MULTICAST(a) IN_CLASSD(a)
#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
#define IN_BADCLASS(a) IN_EXPERIMENTAL((a))
/* Address to accept any incoming messages. */
#define INADDR_ANY ((unsigned long int) 0x00000000)
/* Address to send to all hosts. */
#define INADDR_BROADCAST ((unsigned long int) 0xffffffff)
/* Address indicating an error return. */
#define INADDR_NONE ((unsigned long int) 0xffffffff)
#define NIPADDR(addr) \
(uint8_t)(addr & 0x000000FF), \
(uint8_t)((addr & 0x0000FF00) >> 8), \
(uint8_t)((addr & 0x00FF0000) >> 16), \
(uint8_t)((addr & 0xFF000000) >> 24)
#define NIP6ADDR(addr) \
ntohs((addr)->s6_addr16[0]), \
ntohs((addr)->s6_addr16[1]), \
ntohs((addr)->s6_addr16[2]), \
ntohs((addr)->s6_addr16[3]), \
ntohs((addr)->s6_addr16[4]), \
ntohs((addr)->s6_addr16[5]), \
ntohs((addr)->s6_addr16[6]), \
ntohs((addr)->s6_addr16[7])
#define IN6_IS_ADDR_UNSPECIFIED(a) \
(((__const uint32_t *) (a))[0] == 0 \
&& ((__const uint32_t *) (a))[1] == 0 \
&& ((__const uint32_t *) (a))[2] == 0 \
&& ((__const uint32_t *) (a))[3] == 0)
#define IN6_IS_ADDR_LOOPBACK(a) \
(((__const uint32_t *) (a))[0] == 0 \
&& ((__const uint32_t *) (a))[1] == 0 \
&& ((__const uint32_t *) (a))[2] == 0 \
&& ((__const uint32_t *) (a))[3] == htonl (1))
#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
#define IN6_IS_ADDR_LINKLOCAL(a) \
((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
== htonl (0xfe800000))
#define IN6_IS_ADDR_SITELOCAL(a) \
((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
== htonl (0xfec00000))
#define IN6_IS_ADDR_V4MAPPED(a) \
((((__const uint32_t *) (a))[0] == 0) \
&& (((__const uint32_t *) (a))[1] == 0) \
&& (((__const uint32_t *) (a))[2] == htonl (0xffff)))
#define IN6_IS_ADDR_V4COMPAT(a) \
((((__const uint32_t *) (a))[0] == 0) \
&& (((__const uint32_t *) (a))[1] == 0) \
&& (((__const uint32_t *) (a))[2] == 0) \
&& (ntohl (((__const uint32_t *) (a))[3]) > 1))
#define IN6_ARE_ADDR_EQUAL(a,b) \
((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0]) \
&& (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \
&& (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \
&& (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) \
&& ((((__const uint8_t *) (a))[1] & 0xf) == 0x1))
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) \
&& ((((__const uint8_t *) (a))[1] & 0xf) == 0x2))
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) \
&& ((((__const uint8_t *) (a))[1] & 0xf) == 0x5))
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) \
&& ((((__const uint8_t *) (a))[1] & 0xf) == 0x8))
#define IN6_IS_ADDR_MC_GLOBAL(a) \
(IN6_IS_ADDR_MULTICAST(a) \
&& ((((__const uint8_t *) (a))[1] & 0xf) == 0xe))
#define IN6_ARE_ADDR_MASKED_EQUAL(a,b,m) \
(((((__const uint32_t *) (a))[0] & (((__const uint32_t *) (m))[0])) == (((__const uint32_t *) (b))[0] & (((__const uint32_t *) (m))[0]))) \
&& ((((__const uint32_t *) (a))[1] & (((__const uint32_t *) (m))[1])) == (((__const uint32_t *) (b))[1] & (((__const uint32_t *) (m))[1]))) \
&& ((((__const uint32_t *) (a))[2] & (((__const uint32_t *) (m))[2])) == (((__const uint32_t *) (b))[2] & (((__const uint32_t *) (m))[2]))) \
&& ((((__const uint32_t *) (a))[3] & (((__const uint32_t *) (m))[3])) == (((__const uint32_t *) (b))[3] & (((__const uint32_t *) (m))[3]))))
#define IN_ARE_ADDR_MASKED_EQUAL(a,b,m) \
(((((__const uint8_t *) (a))[0] & (((__const uint8_t *) (m))[0])) == (((__const uint8_t *) (b))[0] & (((__const uint8_t *) (m))[0]))) \
&& ((((__const uint8_t *) (a))[1] & (((__const uint8_t *) (m))[1])) == (((__const uint8_t *) (b))[1] & (((__const uint8_t *) (m))[1]))) \
&& ((((__const uint8_t *) (a))[2] & (((__const uint8_t *) (m))[2])) == (((__const uint8_t *) (b))[2] & (((__const uint8_t *) (m))[2]))) \
&& ((((__const uint8_t *) (a))[3] & (((__const uint8_t *) (m))[3])) == (((__const uint8_t *) (b))[3] & (((__const uint8_t *) (m))[3]))))
//---------------------------------------------------------------------------
// Find the IP traffic type (UNICAST, MULTICAST, BROADCAST)
ip_traffic_type_t oai_nw_drv_find_traffic_type(struct sk_buff *skb)
{
//---------------------------------------------------------------------------
ip_traffic_type_t traffic_type = TRAFFIC_IPVX_TYPE_UNKNOWN;
if (skb!=NULL) {
switch (ntohs(skb->protocol)) {
case ETH_P_IPV6:
traffic_type = TRAFFIC_IPV6_TYPE_UNKNOWN;
#ifdef OAI_DRV_DEBUG_CLASS
printk("SOURCE ADDR %X:%X:%X:%X:%X:%X:%X:%X",NIP6ADDR(&(ipv6_hdr(skb)->saddr)));
printk(" DEST ADDR %X:%X:%X:%X:%X:%X:%X:%X\n",NIP6ADDR(&(ipv6_hdr(skb)->daddr)));
#endif
if (IN6_IS_ADDR_MULTICAST(&ipv6_hdr(skb)->daddr.in6_u.u6_addr32[0])) {
traffic_type = TRAFFIC_IPV6_TYPE_MULTICAST;
} else {
traffic_type = TRAFFIC_IPV6_TYPE_UNICAST;
}
break;
case ETH_P_IP:
traffic_type = TRAFFIC_IPV4_TYPE_UNKNOWN;
//print_TOOL_pk_ipv4((struct iphdr *)skb->network_header);
if (IN_MULTICAST(htonl(ip_hdr(skb)->daddr))) {
traffic_type = TRAFFIC_IPV4_TYPE_MULTICAST;
} else {
traffic_type = TRAFFIC_IPV4_TYPE_UNICAST;
}
// TO DO BROADCAST
break;
case ETH_P_ARP:
traffic_type = TRAFFIC_IPV4_TYPE_BROADCAST;
break;
default:
;
}
}
return traffic_type;
}
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef _OAI_NW_DRV_CST
#define _OAI_NW_DRV_CST
#define MAX_MEASURE_NB 5
#define OAI_NW_DRV_MAX_LENGTH 180
//Debug flags
//#define OAI_NW_DRV_DEBUG_DC
#define OAI_NW_DRV_DEBUG_SEND
#define OAI_NW_DRV_DEBUG_RECEIVE
//#define OAI_NW_DRV_DEBUG_CLASS
//#define OAI_NW_DRV_DEBUG_GC
//#define OAI_NW_DRV_DEBUG_DC_MEASURE
//#define OAI_NW_DRV_DEBUG_TIMER
//#define OAI_NW_DRV_DEBUG_DEVICE
//#define OAI_NW_DRV_DEBUG_INTERRUPT
//#define OAI_NW_DRV_DEBUG_TOOL
// Other flags
#define DEMO_3GSM
// General Constants
#define OAI_NW_DRV_MTU 1500
#define OAI_NW_DRV_TX_QUEUE_LEN 100
#define OAI_NW_DRV_ADDR_LEN 8
#define OAI_NW_DRV_INET6_ADDRSTRLEN 46
#define OAI_NW_DRV_INET_ADDRSTRLEN 16
#define OAI_NW_DRV_RESET_RX_FLAGS 0
#define OAI_NW_DRV_CX_MAX 32 //Identical to RRC constant
//#define OAI_NW_DRV_CX_MULTICAST_ALLNODE 2
#define OAI_NW_DRV_RETRY_LIMIT_DEFAULT 5
#define OAI_NW_DRV_MESSAGE_MAXLEN 5004
#define OAI_NW_DRV_SIG_SRB3 3
#define OAI_NW_DRV_SIG_SRB4 3 // not used yet
//peer-to-peer messages between NAS entities
#define OAI_NW_DRV_CMD_OPEN_RB 1
//#define OAI_NW_DRV_IID1_CONTROL 0x0
//#define OAI_NW_DRV_IID2_CONTROL __constant_htonl(0xffffffff)
//#define OAI_NW_DRV_STATE_IDLE 0
//#define OAI_NW_DRV_STATE_CONNECTED 1
//#define OAI_NW_DRV_STATE_ESTABLISHMENT_REQUEST 2
//#define OAI_NW_DRV_STATE_ESTABLISHMENT_FAILURE 3
//#define OAI_NW_DRV_STATE_RELEASE_FAILURE 4
#define OAI_NW_DRV_CX_RELEASE_UNDEF_CAUSE 1
// MT+RG NAS States
#define OAI_NW_DRV_IDLE 0x01
// Connection
#define OAI_NW_DRV_CX_FACH 0x06
#define OAI_NW_DRV_CX_DCH 0x0A
#define OAI_NW_DRV_CX_RECEIVED 0x10
#define OAI_NW_DRV_CX_CONNECTING 0x04
#define OAI_NW_DRV_CX_RELEASING 0x08
#define OAI_NW_DRV_CX_CONNECTING_FAILURE 0x14
#define OAI_NW_DRV_CX_RELEASING_FAILURE 0x18
// Radio Bearers
#define OAI_NW_DRV_RB_ESTABLISHING 0x24
#define OAI_NW_DRV_RB_RELEASING 0x28
#define OAI_NW_DRV_RB_DCH 0x2A
#define OAI_NW_DRV_TIMER_ESTABLISHMENT_DEFAULT 12
#define OAI_NW_DRV_TIMER_RELEASE_DEFAULT 2
#define OAI_NW_DRV_TIMER_IDLE UINT_MAX
#define OAI_NW_DRV_TIMER_TICK HZ
#define OAI_NW_DRV_PDCPH_SIZE sizeof(struct pdcp_data_req_header_s)
#define OAI_NW_DRV_IPV4_SIZE 20
#define OAI_NW_DRV_IPV6_SIZE 40
#define OAI_NW_DRV_DIRECTION_SEND 0
#define OAI_NW_DRV_DIRECTION_RECEIVE 1
#define OAI_NW_DRV_DIRECTION_FORWARD 2
// function number
#define OAI_NW_DRV_FCT_DEL_SEND 1
#define OAI_NW_DRV_FCT_QOS_SEND 2
#define OAI_NW_DRV_FCT_DC_SEND 3
#define OAI_NW_DRV_FCT_CTL_SEND 4
// type of IOCTL command
#define OAI_NW_DRV_IOCTL_RRM 0x89F0
// Error cause
#define OAI_NW_DRV_ERROR_ALREADYEXIST 1
#define OAI_NW_DRV_ERROR_NOMEMORY 3
#define OAI_NW_DRV_ERROR_NOTMT 9
#define OAI_NW_DRV_ERROR_NOTRG 10
#define OAI_NW_DRV_ERROR_NOTIDLE 11
#define OAI_NW_DRV_ERROR_NOTCONNECTED 12
#define OAI_NW_DRV_ERROR_NORB 14
#define OAI_NW_DRV_ERROR_NOTCORRECTVALUE 32
#define OAI_NW_DRV_ERROR_NOTCORRECTLCR 33
#define OAI_NW_DRV_ERROR_NOTCORRECTDIR 34
#define OAI_NW_DRV_ERROR_NOTCORRECTDSCP 35
#define OAI_NW_DRV_ERROR_NOTCORRECTVERSION 36
#define OAI_NW_DRV_ERROR_NOTCORRECTRABI 37
/**********************************************************/
/* Constants related with IP protocols */
/**********************************************************/
//#define OAI_NW_DRV_PORT_CONTROL __constant_htons(0xc45)
//#define OAI_NW_DRV_PORT_AUTHENTICATION __constant_htons(1811)
#define OAI_NW_DRV_TRAFFICCLASS_MASK __constant_htonl(0x0fc00000)
// Network control codepoint 111000 + IP version 6
#define OAI_NW_DRV_FLOWINFO_NCONTROL __constant_htonl(0x6e000000)
// network control codepoint 111000
#define OAI_NW_DRV_DSCP_NCONTROL 56 //0x38
// default codepoint 1000000
#define OAI_NW_DRV_DSCP_DEFAULT 64
#define OAI_NW_DRV_DSCP_MAX 193
#define OAI_NW_DRV_PROTOCOL_DEFAULT 0
#define OAI_NW_DRV_PROTOCOL_TCP IPPROTO_TCP
#define OAI_NW_DRV_PROTOCOL_UDP IPPROTO_UDP
#define OAI_NW_DRV_PROTOCOL_ICMP4 IPPROTO_ICMP
#define OAI_NW_DRV_PROTOCOL_ICMP6 IPPROTO_ICMPV6
//#warning "OAI_NW_DRV_PROTOCOL_ARP value 200 may collide with new defined values in kernel"
#define OAI_NW_DRV_PROTOCOL_ARP 200
#define OAI_NW_DRV_PORT_DEFAULT __constant_htons(65535)
#define OAI_NW_DRV_PORT_HTTP __constant_htons(80)
#define OAI_NW_DRV_IP_VERSION_ALL 0
#define OAI_NW_DRV_IP_VERSION_4 4
#define OAI_NW_DRV_IP_VERSION_6 6
#define OAI_NW_DRV_DEFAULT_IPV4_ADDR 0
#define OAI_NW_DRV_DEFAULT_IPV6_ADDR0 0
#define OAI_NW_DRV_DEFAULT_IPV6_ADDR1 0
#define OAI_NW_DRV_DEFAULT_IPV6_ADDR2 0
#define OAI_NW_DRV_DEFAULT_IPV6_ADDR3 0
#define OAI_NW_DRV_MPLS_VERSION_CODE 99
#define OAI_NW_DRV_NB_INSTANCES_MAX 8
#endif
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "local.h"
#include "ioctl.h"
#include "proto_extern.h"
#include <asm/uaccess.h>
#include <asm/checksum.h>
#include <asm/uaccess.h>
#define NIP6ADDR(addr) \
ntohs((addr)->s6_addr16[0]), \
ntohs((addr)->s6_addr16[1]), \
ntohs((addr)->s6_addr16[2]), \
ntohs((addr)->s6_addr16[3]), \
ntohs((addr)->s6_addr16[4]), \
ntohs((addr)->s6_addr16[5]), \
ntohs((addr)->s6_addr16[6]), \
ntohs((addr)->s6_addr16[7])
uint8_t g_msgrep[OAI_NW_DRV_LIST_CLASS_MAX*sizeof(struct oai_nw_drv_msg_class_list_reply)+1];
// Statistic
//---------------------------------------------------------------------------
void oai_nw_drv_set_msg_statistic_reply(struct oai_nw_drv_msg_statistic_reply *msgrep,
struct oai_nw_drv_priv *priv)
{
//---------------------------------------------------------------------------
msgrep->rx_packets=priv->stats.rx_packets;
msgrep->tx_packets=priv->stats.tx_packets;
msgrep->rx_bytes=priv->stats.rx_bytes;
msgrep->tx_bytes=priv->stats.tx_bytes;
msgrep->rx_errors=priv->stats.rx_errors;
msgrep->tx_errors=priv->stats.tx_errors;
msgrep->rx_dropped=priv->stats.rx_dropped;
msgrep->tx_dropped=priv->stats.tx_dropped;
}
//---------------------------------------------------------------------------
int oai_nw_drv_ioCTL_statistic_request(struct oai_nw_drv_ioctl *gifr,
struct oai_nw_drv_priv *priv)
{
//---------------------------------------------------------------------------
struct oai_nw_drv_msg_statistic_reply msgrep;
printk("NAS_IOCTL_STATISTIC: stat requested\n");
oai_nw_drv_set_msg_statistic_reply(&msgrep,priv);
if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
printk("NAS_IOCTL_STATISTIC: copy_to_user failure\n");
return -EFAULT;
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// IMEI
// Messages for IMEI transfer
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// IOCTL command
//---------------------------------------------------------------------------
int oai_nw_drv_CTL_ioctl(struct net_device *dev,
struct ifreq *ifr,
int cmd)
{
//---------------------------------------------------------------------------
struct oai_nw_drv_ioctl *gifr;
struct oai_nw_drv_priv *priv=netdev_priv(dev);
int r;
// printk("NAS_CTL_IOCTL: begin ioctl for instance %d\n",find_inst(dev));
switch(cmd) {
case OAI_NW_DRV_IOCTL_RRM:
gifr=(struct oai_nw_drv_ioctl *)ifr;
switch(gifr->type) {
case OAI_NW_DRV_MSG_STATISTIC_REQUEST:
r=oai_nw_drv_ioCTL_statistic_request(gifr,priv);
break;
default:
// printk("NAS_IOCTL_RRM: unkwon request type, type=%x\n", gifr->type);
r=-EFAULT;
}
break;
default:
// printk("NAS_CTL_IOCTL: Unknown ioctl command, cmd=%x\n", cmd);
r=-EFAULT;
}
// printk("NAS_CTL_IOCTL: end\n");
return r;
}
//---------------------------------------------------------------------------
void oai_nw_drv_CTL_send(struct sk_buff *skb, int inst)
{
//---------------------------------------------------------------------------
printk("NAS_CTL_SEND - void \n");
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/***************************************************************************
ioctl.h - description
-------------------
copyright : (C) 2002 by Eurecom
email : michelle.wetterwald@eurecom.fr
yan.moret@eurecom.fr
knopp@eurecom.fr
***************************************************************************
***************************************************************************/
#ifndef OAI_IOCTL_H
#define OAI_IOCTL_H
#include <asm/byteorder.h>
#include <asm/types.h>
#include <linux/udp.h>
#include <linux/tcp.h>
#include <linux/if.h>
#include "sap.h"
//#include <linux/ipv6.h>
#define OAI_NW_DRV_MSG_MAXLEN 1100/// change???
// type of CTL message
#define OAI_NW_DRV_MSG_STATISTIC_REQUEST 1
#define OAI_NW_DRV_MSG_STATISTIC_REPLY 2
#define OAI_NW_DRV_MSG_ECHO_REQUEST 3
#define OAI_NW_DRV_MSG_ECHO_REPLY 4
#define OAI_NW_DRV_MSG_CX_ESTABLISHMENT_REQUEST 5
#define OAI_NW_DRV_MSG_CX_ESTABLISHMENT_REPLY 6
#define OAI_NW_DRV_MSG_CX_RELEASE_REQUEST 7
#define OAI_NW_DRV_MSG_CX_RELEASE_REPLY 8
#define OAI_NW_DRV_MSG_CX_LIST_REQUEST 9
#define OAI_NW_DRV_MSG_CX_LIST_REPLY 10
#define OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REQUEST 11
#define OAI_NW_DRV_MSG_RB_ESTABLISHMENT_REPLY 12
#define OAI_NW_DRV_MSG_RB_RELEASE_REQUEST 13
#define OAI_NW_DRV_MSG_RB_RELEASE_REPLY 14
#define OAI_NW_DRV_MSG_RB_LIST_REQUEST 15
#define OAI_NW_DRV_MSG_RB_LIST_REPLY 16
#define OAI_NW_DRV_MSG_CLASS_ADD_REQUEST 17
#define OAI_NW_DRV_MSG_CLASS_ADD_REPLY 18
#define OAI_NW_DRV_MSG_CLASS_DEL_REQUEST 19
#define OAI_NW_DRV_MSG_CLASS_DEL_REPLY 20
#define OAI_NW_DRV_MSG_CLASS_LIST_REQUEST 21
#define OAI_NW_DRV_MSG_CLASS_LIST_REPLY 22
#define OAI_NW_DRV_MSG_MEAS_REQUEST 23
#define OAI_NW_DRV_MSG_MEAS_REPLY 24
#define OAI_NW_DRV_MSG_IMEI_REQUEST 25
#define OAI_NW_DRV_MSG_IMEI_REPLY 26
// Max number of entry of a message list
#define OAI_NW_DRV_LIST_CX_MAX 32
#define OAI_NW_DRV_LIST_RB_MAX 32
#define OAI_NW_DRV_LIST_CLASS_MAX 32
typedef unsigned short oai_nw_drv_MsgType_t;
struct oai_nw_drv_ioctl {
char name[IFNAMSIZ];
oai_nw_drv_MsgType_t type;
char *msg;
};
struct oai_nw_drv_msg_statistic_reply {
unsigned int rx_packets;
unsigned int tx_packets;
unsigned int rx_bytes;
unsigned int tx_bytes;
unsigned int rx_errors;
unsigned int tx_errors;
unsigned int rx_dropped;
unsigned int tx_dropped;
};
struct oai_nw_drv_msg_cx_list_reply {
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
unsigned char state;
OaiNwDrvCellID_t cellid; // cell identification
unsigned int iid6[2]; // IPv6 interface identification
unsigned char iid4; // IPv4 interface identification
unsigned short num_rb;
unsigned short nsclassifier;
};
struct oai_nw_drv_msg_cx_establishment_reply {
int status;
};
struct oai_nw_drv_msg_cx_establishment_request {
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
OaiNwDrvCellID_t cellid; // Cell identification
};
struct oai_nw_drv_msg_cx_release_reply {
int status;
};
struct oai_nw_drv_msg_cx_release_request {
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
};
struct oai_nw_drv_msg_rb_list_reply {
OaiNwDrvRadioBearerId_t rab_id;
OaiNwDrvSapId_t sapi;
OaiNwDrvQoSTrafficClass_t qos;
unsigned char state;
};
struct oai_nw_drv_msg_rb_list_request {
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
};
struct oai_nw_drv_msg_rb_establishment_reply {
int status;
};
struct oai_nw_drv_msg_rb_establishment_request {
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
OaiNwDrvRadioBearerId_t rab_id;
OaiNwDrvQoSTrafficClass_t qos;
};
struct oai_nw_drv_msg_rb_release_reply {
int status;
};
struct oai_nw_drv_msg_rb_release_request {
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
OaiNwDrvRadioBearerId_t rab_id;
};
/*
struct saddr {
struct in6_addr ipv6;
unsigned int ipv4;
};
struct daddr {
struct in6_addr ipv6;
unsigned int ipv4;
unsigned int mpls_label;
};
*/
struct oai_nw_drv_msg_class_add_request {
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
OaiNwDrvRadioBearerId_t rab_id;
OaiNwDrvRadioBearerId_t rab_id_rx;
unsigned char dir; // direction (send or receive, forward)
unsigned char dscp; // codepoint
unsigned char fct;
unsigned short classref;
unsigned char version;
//struct daddr daddr;
//struct saddr saddr;
unsigned char splen; // prefix length
union {
struct in6_addr ipv6;
// begin navid
//in_addr_t ipv4;
unsigned int ipv4;
//end navid
unsigned int mpls_label;
} daddr; // IP destination address
union {
struct in6_addr ipv6;
// begin navid
//in_addr_t ipv4;
unsigned int ipv4;
//end navid
} saddr; // IP source address
unsigned char dplen; // prefix length
unsigned char protocol; //!< transport layer protocol type (ANY,TCP,UDP,ICMPv4,ICMPv6)
unsigned char protocol_message_type; //!< transport layer protocol message (ROUTER_ADV, ROUTER_SOLL, etc.)
unsigned short sport; //!< source port
unsigned short dport; //!< destination port
};
struct oai_nw_drv_msg_class_add_reply {
int status;
};
struct oai_nw_drv_msg_class_del_request {
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
unsigned char dir; // direction (send or receive)
unsigned char dscp; // codepoint
unsigned short classref;
};
struct oai_nw_drv_msg_class_del_reply {
int status;
};
#define oai_nw_drv_msg_class_list_reply oai_nw_drv_msg_class_add_request
struct oai_nw_drv_msg_class_list_request {
OaiNwDrvLocalConnectionRef_t lcr; // Local Connection reference
unsigned char dir;
unsigned char dscp;
};
// Messages for Measurement transfer - MW 01/04/2005
typedef unsigned int nioctlProviderId_t;
typedef unsigned short nioctlSignalLoss_t;
typedef struct nioctlMeasures {
OaiNwDrvCellID_t cell_id;
OaiNwDrvSigLevel_t level;
nioctlProviderId_t provider_id;
} nioctlMeasures_t;
struct oai_nw_drv_msg_measure_request {
OaiNwDrvNumRGsMeas_t num_cells;
OaiNwDrvCellID_t cellid[OAI_NW_DRV_MAX_MEASURE_NB]; // Cell identification
unsigned short num_providers;
nioctlProviderId_t provider_id[OAI_NW_DRV_MAX_MEASURE_NB]; // Provider identification
};
struct oai_nw_drv_msg_measure_reply {
OaiNwDrvNumRGsMeas_t num_cells;
nioctlMeasures_t measures[OAI_NW_DRV_MAX_MEASURE_NB];
nioctlSignalLoss_t signal_lost_flag;
};
// Messages for Measurement transfer - MW 01/04/2005
typedef unsigned int nioctlL2Id_t[2];
struct oai_nw_drv_msg_l2id_reply {
nioctlL2Id_t l2id;
};
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/***************************************************************************
local.h - description
-------------------
copyright : (C) 2002 by Eurecom
email :navid.nikaein@eurecom.fr
lionel.gauthier@eurecom.fr
knopp@eurecom.fr
***************************************************************************
***************************************************************************/
#ifndef OAI_LOCAL_H
#define OAI_LOCAL_H
#include <linux/if_arp.h>
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/ipv6.h>
#include <linux/ip.h>
#include <linux/sysctl.h>
#include <linux/timer.h>
#include <linux/unistd.h>
#include <asm/param.h>
//#include <sys/sysctl.h>
#include <linux/udp.h>
#include <linux/tcp.h>
#include <linux/icmp.h>
#include <linux/icmpv6.h>
#include <linux/in.h>
#include <net/ndisc.h>
#define PDCP2IP_FIFO 21
#define IP2PDCP_FIFO 22
#include "constant.h"
#include "common/platform_types.h"
#include "sap.h"
struct cx_entity {
int sap[OAI_NW_DRV_SAPI_CX_MAX];
uint8_t state; // state of the connection
OaiNwDrvLocalConnectionRef_t lcr; // Local connection reference
OaiNwDrvCellID_t cellid; // cell identification
uint32_t countimer; // timeout's counter
uint8_t retry; // number of retransmission
uint32_t iid6[2]; // IPv6 interface identification
uint8_t iid4; // IPv4 interface identification
int lastRRCprimitive;
//measures
int req_prov_id [OAI_NW_DRV_MAX_MEASURE_NB];
int num_measures;
int meas_cell_id[OAI_NW_DRV_MAX_MEASURE_NB];
int meas_level [OAI_NW_DRV_MAX_MEASURE_NB];
int provider_id [OAI_NW_DRV_MAX_MEASURE_NB];
};
struct oai_nw_drv_priv {
int irq;
int rx_flags;
struct timer_list timer;
spinlock_t lock;
struct net_device_stats stats;
uint8_t retry_limit;
uint32_t timer_establishment;
uint32_t timer_release;
struct cx_entity cx[OAI_NW_DRV_CX_MAX];
//struct classifier_entity *rclassifier[OAI_NW_DRV_DSCP_MAX]; // receive classifier
uint16_t nrclassifier;
int sap[OAI_NW_DRV_SAPI_MAX];
struct sock *nl_sk;
uint8_t nlmsg[OAI_NW_DRV_PRIMITIVE_MAX_LENGTH+sizeof(struct nlmsghdr)];
uint8_t xbuffer[OAI_NW_DRV_PRIMITIVE_MAX_LENGTH]; // transmition buffer
uint8_t rbuffer[OAI_NW_DRV_PRIMITIVE_MAX_LENGTH]; // reception buffer
};
struct ipversion {
#if defined(__LITTLE_ENDIAN_BITFIELD)
uint8_t reserved:4,
version:4;
#else
uint8_t version:4,
reserved:4;
#endif
};
typedef struct pdcp_data_req_header_s {
rb_id_t rb_id;
sdu_size_t data_size;
signed int inst;
ip_traffic_type_t traffic_type;
} pdcp_data_req_header_t;
typedef struct pdcp_data_ind_header_s {
rb_id_t rb_id;
sdu_size_t data_size;
signed int inst;
ip_traffic_type_t dummy_traffic_type;
} pdcp_data_ind_header_t;
extern struct net_device *oai_nw_drv_dev[OAI_NW_DRV_NB_INSTANCES_MAX];
extern uint8_t OAI_NW_DRV_NULL_IMEI[14];
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file netlink.c
* \brief establish a netlink
* \author Navid Nikaein, Lionel Gauthier, and Raymond knopp
* \company Eurecom
* \email:navid.nikaein@eurecom.fr, lionel.gauthier@eurecom.fr, knopp@eurecom.fr
*/
#include <linux/version.h>
//#include <linux/config.h>
#include <linux/socket.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netlink.h>
#include <net/sock.h>
#include <linux/kthread.h>
#include <linux/mutex.h>
#include "local.h"
#include "proto_extern.h"
//#define NETLINK_DEBUG 1
#define OAI_IP_DRIVER_NETLINK_ID 31
#define NL_DEST_PID 1
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
struct netlink_kernel_cfg oai_netlink_cfg;
#endif
static struct sock *nas_nl_sk = NULL;
static int exit_netlink_thread=0;
static int nas_netlink_rx_thread(void *);
static DEFINE_MUTEX(nasmesh_mutex);
static inline void nasmesh_lock(void)
{
mutex_lock(&nasmesh_mutex);
}
static inline void nasmesh_unlock(void)
{
mutex_unlock(&nasmesh_mutex);
}
// This can also be implemented using thread to get the data from PDCP without blocking.
static void nas_nl_data_ready (struct sk_buff *skb)
{
// wake_up_interruptible(skb->sk->sk_sleep);
//nasmesh_lock();
//netlink_rcv_skb(skb, &my_rcv_msg);// my_rcv_msg is the call back func>
//nasmesh_unlock();
struct nlmsghdr *nlh = NULL;
if (skb) {
#ifdef NETLINK_DEBUG
printk("[OAI_IP_DRV][NETLINK] Received socket from PDCP\n");
#endif //NETLINK_DEBUG
nlh = (struct nlmsghdr *)skb->data;
oai_nw_drv_common_wireless2ip(nlh);
//kfree_skb(skb); // not required,
}
}
int oai_nw_drv_netlink_init(void)
{
printk("[OAI_IP_DRV][NETLINK] Running init ...\n");
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
oai_netlink_cfg.groups = 0;
oai_netlink_cfg.input = nas_nl_data_ready;
oai_netlink_cfg.cb_mutex = &nasmesh_mutex;
oai_netlink_cfg.bind = NULL;
nas_nl_sk = netlink_kernel_create(
&init_net,
OAI_IP_DRIVER_NETLINK_ID,
# if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
THIS_MODULE,
# endif
&oai_netlink_cfg);
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
nas_nl_sk = netlink_kernel_create(
&init_net,
OAI_IP_DRIVER_NETLINK_ID,
0,
nas_nl_data_ready,
&nasmesh_mutex, // NULL
THIS_MODULE);
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
if (nas_nl_sk == NULL) {
printk("[OAI_IP_DRV][NETLINK] netlink_kernel_create failed \n");
return(-1);
}
return(0);
}
void oai_nw_drv_netlink_release(void)
{
exit_netlink_thread=1;
printk("[OAI_IP_DRV][NETLINK] Releasing netlink socket\n");
if(nas_nl_sk) {
netlink_kernel_release(nas_nl_sk); //or skb->sk
}
// printk("[OAI_IP_DRV][NETLINK] Removing netlink_rx_thread\n");
//kthread_stop(netlink_rx_thread);
}
int oai_nw_drv_netlink_send(unsigned char *data,unsigned int len)
{
struct sk_buff *nl_skb = alloc_skb(NLMSG_SPACE(len),GFP_ATOMIC);
struct nlmsghdr *nlh = (struct nlmsghdr *)nl_skb->data;
int status;
// printk("[OAI_IP_DRV][NETLINK] Sending %d bytes (%d)\n",len,NLMSG_SPACE(len));
skb_put(nl_skb, NLMSG_SPACE(len));
memcpy(NLMSG_DATA(nlh),data,len);
nlh->nlmsg_len = NLMSG_SPACE(len);
nlh->nlmsg_pid = 0; /* from kernel */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
NETLINK_CB(nl_skb).portid = 0;
#else
NETLINK_CB(nl_skb).pid = 0;
#endif
#ifdef NETLINK_DEBUG
printk("[OAI_IP_DRV][NETLINK] In nas_netlink_send, nl_skb %p, nl_sk %x, nlh %p, nlh->nlmsg_len %d\n",nl_skb,nas_nl_sk,nlh,nlh->nlmsg_len);
#endif //DEBUG_NETLINK
if (nas_nl_sk) {
// nasmesh_lock();
status = netlink_unicast(nas_nl_sk, nl_skb, NL_DEST_PID, MSG_DONTWAIT);
// mutex_unlock(&nasmesh_mutex);
if (status < 0) {
printk("[OAI_IP_DRV][NETLINK] SEND status is %d\n",status);
return(0);
} else {
#ifdef NETLINK_DEBUG
printk("[OAI_IP_DRV][NETLINK] SEND status is %d\n",status);
#endif
return len;
}
} else {
printk("[OAI_IP_DRV][SEND] socket is NULL\n");
return(0);
}
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/***************************************************************************
proto_extern.h - description
-------------------
copyright : (C) 2002 by Eurecom
email : michelle.wetterwald@eurecom.fr
yan.moret@eurecom.fr
knopp@eurecom.fr
***************************************************************************
***************************************************************************/
#ifndef __NETWORK_DRIVER_LITE_PROTO_EXTERN__H__
#define __NETWORK_DRIVER_LITE_PROTO_EXTERN__H__
#include <linux/if_arp.h>
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/ipv6.h>
#include <linux/ip.h>
#include <linux/sysctl.h>
#include <linux/timer.h>
#include <asm/param.h>
//#include <sys/sysctl.h>
#include <linux/udp.h>
#include <linux/tcp.h>
#include <linux/icmp.h>
#include <linux/icmpv6.h>
#include <linux/in.h>
#include <net/ndisc.h>
#include "local.h"
// device.c
/** @defgroup _oai_nw_drv_impl_ OAI Network Device for RRC Lite
* @ingroup _ref_implementation_
* @{
\fn int oai_nw_drv_find_inst(struct net_device *dev)
\brief This function determines the instance id for a particular device pointer.
@param dev Pointer to net_device structure
*/
int oai_nw_drv_find_inst(struct net_device *dev);
// common.c
/**
\fn void oai_nw_drv_common_class_wireless2ip(unsigned short dlen, void* pdcp_sdu,int inst,OaiNwDrvRadioBearerId_t rb_id)
\brief Receive classified LTE packet, build skbuff struct with it and deliver it to the OS network layer.
@param dlen Length of SDU in bytes
@param pdcp_sdu Pointer to received SDU
@param inst Instance number
@param rb_id Radio Bearer Id
*/
void oai_nw_drv_common_class_wireless2ip(unsigned short dlen,
void *pdcp_sdu,
int inst,
OaiNwDrvRadioBearerId_t rb_id);
/**
\fn void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst)
\brief Request the transfer of data (QoS SAP)
@param skb pointer to socket buffer
@param inst device instance
*/
void oai_nw_drv_common_ip2wireless(struct sk_buff *skb, int inst);
/**
\fn void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst)
\brief Drop the IP packet comming from the OS network layer.
@param skb pointer to socket buffer
@param inst device instance
*/
void oai_nw_drv_common_ip2wireless_drop(struct sk_buff *skb, int inst);
#ifndef OAI_NW_DRIVER_USE_NETLINK
/**
\fn void oai_nw_drv_common_wireless2ip()
\brief Retrieve PDU from PDCP through RT-fifos for delivery to the IP stack.
*/
void oai_nw_drv_common_wireless2ip(void);
#else
/**
\fn void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh)
\brief Retrieve PDU from PDCP through netlink sockets for delivery to the IP stack.
*/
void oai_nw_drv_common_wireless2ip(struct nlmsghdr *nlh);
#endif //OAI_NW_DRIVER_USE_NETLINK
#ifdef OAI_NW_DRIVER_USE_NETLINK
/**
\fn int oai_nw_drv_netlink_send(unsigned char *data,unsigned int len)
\brief Request the transfer of data by PDCP via netlink socket
@param data pointer to SDU
@param len length of SDU in bytes
@returns Numeber of bytes transfered by netlink socket
*/
int oai_nw_drv_netlink_send(unsigned char *data,unsigned int len);
/**
\fn void oai_nw_drv_COMMON_QOS_receive(struct nlmsghdr *nlh)
\brief Request a PDU from PDCP
@param nlh pointer to netlink message header
*/
void oai_nw_drv_COMMON_QOS_receive(struct nlmsghdr *nlh);
#endif //OAI_NW_DRIVER_USE_NETLINK
// iocontrol.c
void oai_nw_drv_CTL_send(struct sk_buff *skb, int inst);
int oai_nw_drv_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
// classifier.c
/**
\brief Find the IP traffic type (UNICAST, MULTICAST, BROADCAST) of the IP packet attached to sk_buff.
*/
ip_traffic_type_t oai_nw_drv_find_traffic_type(struct sk_buff *skb);
// tool.c
void oai_nw_drv_TOOL_imei2iid(unsigned char *imei, unsigned char *iid);
void oai_nw_drv_TOOL_eNB_imei2iid(unsigned char *imei, unsigned char *iid, unsigned char len);
unsigned char oai_nw_drv_TOOL_get_dscp6(struct ipv6hdr *iph);
unsigned char oai_nw_drv_TOOL_get_dscp4(struct iphdr *iph);
unsigned char *oai_nw_drv_TOOL_get_protocol6(struct ipv6hdr *iph, unsigned char *protocol);
unsigned char *oai_nw_drv_TOOL_get_protocol4(struct iphdr *iph, unsigned char *protocol);
char *oai_nw_drv_TOOL_get_udpmsg(struct udphdr *udph);
unsigned short oai_nw_drv_TOOL_udpcksum(struct in6_addr *saddr, struct in6_addr *daddr, unsigned char proto, unsigned int udplen, void *data);
int oai_nw_drv_TOOL_network6(struct in6_addr *addr, struct in6_addr *prefix, unsigned char plen);
int oai_nw_drv_TOOL_network4(unsigned int *addr, unsigned int *prefix, unsigned char plen);
void print_TOOL_pk_icmp6(struct icmp6hdr *icmph);
void print_TOOL_pk_all(struct sk_buff *skb);
void print_TOOL_pk_ipv6(struct ipv6hdr *iph);
void print_TOOL_state(unsigned char state);
void oai_nw_drv_tool_print_buffer(char * buffer,int length);
#ifdef OAI_NW_DRIVER_USE_NETLINK
// netlink.c
void oai_nw_drv_netlink_release(void);
int oai_nw_drv_netlink_init(void);
#endif
/** @} */
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef OAI_SAP_H
#define OAI_SAP_H
typedef unsigned short OaiNwDrvRadioBearerId_t;
typedef unsigned int OaiNwDrvSapId_t; // Id of the QoS SAP to use
typedef unsigned short OaiNwDrvQoSTrafficClass_t; // QoS traffic class requested
typedef unsigned int OaiNwDrvLocalConnectionRef_t; // local identifier
typedef unsigned short OaiNwDrvCellID_t; // ID of the cell for connection
typedef unsigned short OaiNwDrvNumRGsMeas_t; // number of RGs that could be measured
typedef unsigned int OaiNwDrvSigLevel_t; // Signal level measured
#define OAI_NW_DRV_SAPI_CX_MAX 2
#define OAI_NW_DRV_MAX_MEASURE_NB 5
#define OAI_NW_DRV_PRIMITIVE_MAX_LENGTH 180 // maximum length of a NAS primitive
#define OAI_NW_DRV_SAPI_MAX 4
#define OAI_NW_DRV_RAB_INPUT_SAPI 2
#define OAI_NW_DRV_RAB_OUTPUT_SAPI 3
#define OAI_NW_DRV_MAX_RABS 8 * 64 //NB_RAB_MAX * MAX_MOBILES_PER_RG //27 // = MAXURAB
#define OAI_NW_DRV_LIST_RB_MAX 32
#endif
This diff is collapsed.
CC = gcc
NAS_DIR = ..
rb_tool: rb_tool.c
$(CC) rb_tool.c -o rb_tool -I../ -g -ggdb
all: rb_tool
clean:
rm -f rb_tool
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <sys/types.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
typedef unsigned int sdu_size_t;
typedef unsigned int rb_id_t;
typedef struct pdcp_data_req_header_t {
rb_id_t rb_id;
sdu_size_t data_size;
int inst;
} pdcp_data_req_header_t;
typedef struct pdcp_data_ind_header_t {
rb_id_t rb_id;
sdu_size_t data_size;
int inst;
} pdcp_data_ind_header_t;
#define MAX_PAYLOAD 1024 /* maximum payload size*/
struct sockaddr_nl src_addr, dest_addr;
struct nlmsghdr *nlh = NULL;
struct iovec iov;
int sock_fd;
struct msghdr msg;
void foo( int sig )
{
printf("I got cntl-C, closing socket\n");
close(sock_fd);
exit(-1);
}
#define OAI_IP_DRIVER_NETLINK_ID 31
void main()
{
struct sigaction newaction;
int i=0;
int ret;
int len;
newaction.sa_handler = foo;
if ( sigaction( SIGINT, &newaction, NULL ) == -1)
perror("Could not install the new signal handler");
sock_fd = socket(PF_NETLINK, SOCK_RAW,OAI_IP_DRIVER_NETLINK_ID);
printf("Opened socket with fd %d\n",sock_fd);
ret = fcntl(sock_fd,F_SETFL,O_NONBLOCK);
printf("fcntl returns %d\n",ret);
memset(&src_addr, 0, sizeof(src_addr));
src_addr.nl_family = AF_NETLINK;
src_addr.nl_pid = 1;//getpid(); /* self pid */
src_addr.nl_groups = 0; /* not in mcast groups */
ret = bind(sock_fd, (struct sockaddr*)&src_addr,
sizeof(src_addr));
printf("bind returns %d\n",ret);
memset(&dest_addr, 0, sizeof(dest_addr));
dest_addr.nl_family = AF_NETLINK;
dest_addr.nl_pid = 0; /* For Linux Kernel */
dest_addr.nl_groups = 0; /* unicast */
nlh=(struct nlmsghdr *)malloc(NLMSG_SPACE(MAX_PAYLOAD));
/* Fill the netlink message header */
nlh->nlmsg_len = NLMSG_SPACE(MAX_PAYLOAD);
nlh->nlmsg_pid = 1;//getpid(); /* self pid */
nlh->nlmsg_flags = 0;
iov.iov_base = (void *)nlh;
iov.iov_len = nlh->nlmsg_len;
memset(&msg,0,sizeof(msg));
msg.msg_name = (void *)&dest_addr;
msg.msg_namelen = sizeof(dest_addr);
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
/* Read message from kernel */
memset(nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
while (1) {
len = recvmsg(sock_fd, &msg, 0);
if (len<0) {
// exit(-1);
} else {
printf("Received socket with length %d (nlmsg_len = %d)\n",len,nlh->nlmsg_len);
}
usleep(1000);
i=i+1;
if ((i % 100) == 0)
printf("%d\n",i);
/*
for (i=0;i<nlh->nlmsg_len - sizeof(struct nlmsghdr);i++) {
printf("%x ",
((unsigned char *)NLMSG_DATA(nlh))[i]);
}
*/
}
/* Close Netlink Socket */
}
This diff is collapsed.
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef _NAS_CST
#define _NAS_CST
#define MAX_MEASURE_NB 5
#define NAS_MAX_LENGTH 180
//Debug flags
//#define NAS_DEBUG_DC
//#define NAS_DEBUG_SEND
//#define NAS_DEBUG_RECEIVE
//#define NAS_DEBUG_CLASS
//#define NAS_DEBUG_GC
//#define NAS_DEBUG_DC_MEASURE
//#define NAS_DEBUG_TIMER
//#define NAS_DEBUG_DEVICE
//#define NAS_DEBUG_INTERRUPT
//#define NAS_DEBUG_TOOL
// Other flags
#define DEMO_3GSM
// General Constants
#define NAS_MTU 1500
#define NAS_TX_QUEUE_LEN 100
#define NAS_ADDR_LEN 8
#define NAS_INET6_ADDRSTRLEN 46
#define NAS_INET_ADDRSTRLEN 16
#define NAS_CX_MAX 32 //128 //Identical to RRC constant: no you cannot
/* increase to 128 without risking stack problems: KEEP ATTENTION TO COMPILATION WARNINGS */
//#define NAS_CX_MULTICAST_ALLNODE 2
#define NAS_RETRY_LIMIT_DEFAULT 5
#define NAS_MESSAGE_MAXLEN 5004
#define NAS_SIG_SRB3 3
#define NAS_SIG_SRB4 3 // not used yet
//peer-to-peer messages between NAS entities
#define NAS_CMD_OPEN_RB 1
//#define NAS_IID1_CONTROL 0x0
//#define NAS_IID2_CONTROL __constant_htonl(0xffffffff)
//#define NAS_STATE_IDLE 0
//#define NAS_STATE_CONNECTED 1
//#define NAS_STATE_ESTABLISHMENT_REQUEST 2
//#define NAS_STATE_ESTABLISHMENT_FAILURE 3
//#define NAS_STATE_RELEASE_FAILURE 4
#define NAS_CX_RELEASE_UNDEF_CAUSE 1
// MT+RG NAS States
#define NAS_IDLE 0x01
// Connection
#define NAS_CX_FACH 0x06
#define NAS_CX_DCH 0x0A
#define NAS_CX_RECEIVED 0x10
#define NAS_CX_CONNECTING 0x04
#define NAS_CX_RELEASING 0x08
#define NAS_CX_CONNECTING_FAILURE 0x14
#define NAS_CX_RELEASING_FAILURE 0x18
// Radio Bearers
#define NAS_RB_ESTABLISHING 0x24
#define NAS_RB_RELEASING 0x28
#define NAS_RB_DCH 0x2A
#define NAS_TIMER_ESTABLISHMENT_DEFAULT 12
#define NAS_TIMER_RELEASE_DEFAULT 2
#define NAS_TIMER_IDLE UINT_MAX
#define NAS_TIMER_TICK HZ
#define NAS_PDCPH_SIZE sizeof(struct pdcp_data_req_header_s)
#define NAS_IPV4_SIZE 20
#define NAS_IPV6_SIZE 40
#define NAS_DIRECTION_SEND 0
#define NAS_DIRECTION_RECEIVE 1
#define NAS_DIRECTION_FORWARD 2
// function number
#define NAS_FCT_DEL_SEND 1
#define NAS_FCT_QOS_SEND 2
#define NAS_FCT_DC_SEND 3
#define NAS_FCT_CTL_SEND 4
// type of IOCTL command
#define NAS_IOCTL_RRM 0x89F0
// Error cause
#define NAS_ERROR_ALREADYEXIST 1
#define NAS_ERROR_NOMEMORY 3
#define NAS_ERROR_NOTMT 9
#define NAS_ERROR_NOTRG 10
#define NAS_ERROR_NOTIDLE 11
#define NAS_ERROR_NOTCONNECTED 12
#define NAS_ERROR_NORB 14
#define NAS_ERROR_NOTCORRECTVALUE 32
#define NAS_ERROR_NOTCORRECTLCR 33
#define NAS_ERROR_NOTCORRECTDIR 34
#define NAS_ERROR_NOTCORRECTDSCP 35
#define NAS_ERROR_NOTCORRECTVERSION 36
#define NAS_ERROR_NOTCORRECTRABI 37
/**********************************************************/
/* Constants related with IP protocols */
/**********************************************************/
//#define NAS_PORT_CONTROL __constant_htons(0xc45)
//#define NAS_PORT_AUTHENTICATION __constant_htons(1811)
#define NAS_TRAFFICCLASS_MASK __constant_htonl(0x0fc00000)
// Network control codepoint 111000 + IP version 6
#define NAS_FLOWINFO_NCONTROL __constant_htonl(0x6e000000)
// network control codepoint 111000
#define NAS_DSCP_NCONTROL 56 //0x38
// default codepoint 1000000
#define NAS_DSCP_DEFAULT 64
#define NAS_DSCP_MAX 193
#define NAS_PROTOCOL_DEFAULT 0
#define NAS_PROTOCOL_TCP IPPROTO_TCP
#define NAS_PROTOCOL_UDP IPPROTO_UDP
#define NAS_PROTOCOL_ICMP4 IPPROTO_ICMP
#define NAS_PROTOCOL_ICMP6 IPPROTO_ICMPV6
#define NAS_PORT_DEFAULT __constant_htons(65535)
#define NAS_PORT_HTTP __constant_htons(80)
#define NAS_VERSION_DEFAULT 0
#define NAS_VERSION_4 4
#define NAS_VERSION_6 0 //?MW
#define NAS_DEFAULT_IPV4_ADDR 0
#define NAS_DEFAULT_IPV6_ADDR0 0
#define NAS_DEFAULT_IPV6_ADDR1 0
#define NAS_DEFAULT_IPV6_ADDR2 0
#define NAS_DEFAULT_IPV6_ADDR3 0
#define NAS_MPLS_VERSION_CODE 99
#define NB_INSTANCES_MAX 64 //16
#endif
This diff is collapsed.
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef NAS_CTL_H
#define NAS_CTL_H
#include <asm/byteorder.h>
#include <asm/types.h>
#include <linux/udp.h>
#include <linux/tcp.h>
#include <linux/if.h>
//#include <linux/ipv6.h>
#define NAS_MSG_MAXLEN 1100/// change???
// type of CTL message
#define NAS_MSG_STATISTIC_REQUEST 1
#define NAS_MSG_STATISTIC_REPLY 2
#define NAS_MSG_ECHO_REQUEST 3
#define NAS_MSG_ECHO_REPLY 4
#define NAS_MSG_CX_ESTABLISHMENT_REQUEST 5
#define NAS_MSG_CX_ESTABLISHMENT_REPLY 6
#define NAS_MSG_CX_RELEASE_REQUEST 7
#define NAS_MSG_CX_RELEASE_REPLY 8
#define NAS_MSG_CX_LIST_REQUEST 9
#define NAS_MSG_CX_LIST_REPLY 10
#define NAS_MSG_RB_ESTABLISHMENT_REQUEST 11
#define NAS_MSG_RB_ESTABLISHMENT_REPLY 12
#define NAS_MSG_RB_RELEASE_REQUEST 13
#define NAS_MSG_RB_RELEASE_REPLY 14
#define NAS_MSG_RB_LIST_REQUEST 15
#define NAS_MSG_RB_LIST_REPLY 16
#define NAS_MSG_CLASS_ADD_REQUEST 17
#define NAS_MSG_CLASS_ADD_REPLY 18
#define NAS_MSG_CLASS_DEL_REQUEST 19
#define NAS_MSG_CLASS_DEL_REPLY 20
#define NAS_MSG_CLASS_LIST_REQUEST 21
#define NAS_MSG_CLASS_LIST_REPLY 22
#define NAS_MSG_MEAS_REQUEST 23
#define NAS_MSG_MEAS_REPLY 24
#define NAS_MSG_IMEI_REQUEST 25
#define NAS_MSG_IMEI_REPLY 26
// Max number of entry of a message list
#define NAS_LIST_CX_MAX 32
#define NAS_LIST_RB_MAX 32
#define NAS_LIST_CLASS_MAX 16 // 32 is too high!!:
/* risk of stack problems: KEEP ATTENTION TO COMPILATION WARNINGS */
typedef unsigned short nasMsgType_t;
struct nas_ioctl {
char name[IFNAMSIZ];
nasMsgType_t type;
char *msg;
};
struct nas_msg_statistic_reply {
unsigned int rx_packets;
unsigned int tx_packets;
unsigned int rx_bytes;
unsigned int tx_bytes;
unsigned int rx_errors;
unsigned int tx_errors;
unsigned int rx_dropped;
unsigned int tx_dropped;
};
struct nas_msg_cx_list_reply {
nasLocalConnectionRef_t lcr; // Local Connection reference
unsigned char state;
nasCellID_t cellid; // cell identification
unsigned int iid6[2]; // IPv6 interface identification
unsigned char iid4; // IPv4 interface identification
unsigned short num_rb;
unsigned short nsclassifier;
};
struct nas_msg_cx_establishment_reply {
int status;
};
struct nas_msg_cx_establishment_request {
nasLocalConnectionRef_t lcr; // Local Connection reference
nasCellID_t cellid; // Cell identification
};
struct nas_msg_cx_release_reply {
int status;
};
struct nas_msg_cx_release_request {
nasLocalConnectionRef_t lcr; // Local Connection reference
};
struct nas_msg_rb_list_reply {
nasRadioBearerId_t rab_id;
nasSapId_t sapi;
nasQoSTrafficClass_t qos;
unsigned char state;
};
struct nas_msg_rb_list_request {
nasLocalConnectionRef_t lcr; // Local Connection reference
};
struct nas_msg_rb_establishment_reply {
int status;
};
struct nas_msg_rb_establishment_request {
nasLocalConnectionRef_t lcr; // Local Connection reference
nasRadioBearerId_t rab_id;
nasQoSTrafficClass_t qos;
};
struct nas_msg_rb_release_reply {
int status;
};
struct nas_msg_rb_release_request {
nasLocalConnectionRef_t lcr; // Local Connection reference
nasRadioBearerId_t rab_id;
};
/*
struct saddr {
struct in6_addr ipv6;
unsigned int ipv4;
};
struct daddr {
struct in6_addr ipv6;
unsigned int ipv4;
unsigned int mpls_label;
};
*/
struct nas_msg_class_add_request {
nasLocalConnectionRef_t lcr; // Local Connection reference
nasRadioBearerId_t rab_id;
nasRadioBearerId_t rab_id_rx;
unsigned char dir; // direction (send or receive, forward)
unsigned char dscp; // codepoint
unsigned char fct;
unsigned short classref;
unsigned char version;
//struct daddr daddr;
//struct saddr saddr;
unsigned char splen; // prefix length
union {
struct in6_addr ipv6;
// begin navid
//in_addr_t ipv4;
unsigned int ipv4;
//end navid
unsigned int mpls_label;
} daddr; // IP destination address
union {
struct in6_addr ipv6;
// begin navid
//in_addr_t ipv4;
unsigned int ipv4;
//end navid
} saddr; // IP source address
unsigned char dplen; // prefix length
unsigned char protocol; //!< transport layer protocol type (ANY,TCP,UDP,ICMPv4,ICMPv6)
unsigned char protocol_message_type; //!< transport layer protocol message (ROUTER_ADV, ROUTER_SOLL, etc.)
unsigned short sport; //!< source port
unsigned short dport; //!< destination port
};
struct nas_msg_class_add_reply {
int status;
};
struct nas_msg_class_del_request {
nasLocalConnectionRef_t lcr; // Local Connection reference
unsigned char dir; // direction (send or receive)
unsigned char dscp; // codepoint
unsigned short classref;
};
struct nas_msg_class_del_reply {
int status;
};
#define nas_msg_class_list_reply nas_msg_class_add_request
struct nas_msg_class_list_request {
nasLocalConnectionRef_t lcr; // Local Connection reference
unsigned char dir;
unsigned char dscp;
};
// Messages for Measurement transfer - MW 01/04/2005
typedef unsigned int nioctlProviderId_t;
typedef unsigned short nioctlSignalLoss_t;
typedef struct nioctlMeasures {
nasCellID_t cell_id;
nasSigLevel_t level;
nioctlProviderId_t provider_id;
} nioctlMeasures_t;
struct nas_msg_measure_request {
nasNumRGsMeas_t num_cells;
nasCellID_t cellid[MAX_MEASURE_NB]; // Cell identification
unsigned short num_providers;
nioctlProviderId_t provider_id[MAX_MEASURE_NB]; // Provider identification
};
struct nas_msg_measure_reply {
nasNumRGsMeas_t num_cells;
nioctlMeasures_t measures[MAX_MEASURE_NB];
nioctlSignalLoss_t signal_lost_flag;
};
// Messages for Measurement transfer - MW 01/04/2005
typedef unsigned int nioctlL2Id_t[2];
struct nas_msg_l2id_reply {
nioctlL2Id_t l2id;
};
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/***************************************************************************
graal_sap.h - description
-------------------
copyright : (C) 2002 by Eurecom
email : michelle.wetterwald@eurecom.fr
yan.moret@eurecom.fr
***************************************************************************
***************************************************************************/
#ifndef _NAS_SAP_H
#define _NAS_SAP_H
// RT-FIFO identifiers ** must be identical to Access Stratum as_sap.h and rrc_sap.h
#define RRC_DEVICE_GC RRC_SAPI_GCSAP
#define RRC_DEVICE_NT RRC_SAPI_NTSAP
#define RRC_DEVICE_DC_INPUT0 RRC_SAPI_DCSAP_IN
#define RRC_DEVICE_DC_OUTPUT0 RRC_SAPI_DCSAP_OUT
//FIFO indexes in control blocks
#define NAS_DC_INPUT_SAPI 0
#define NAS_DC_OUTPUT_SAPI 1
#define NAS_SAPI_CX_MAX 2
#define NAS_GC_SAPI 0
#define NAS_NT_SAPI 1
#define NAS_RAB_INPUT_SAPI 2
#define NAS_RAB_OUTPUT_SAPI 3
#define NAS_SAPI_MAX 4
#endif
This diff is collapsed.
This the driver for the UE when NAS layer is running in the UE (EPC setting).
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -13,9 +13,6 @@ cd cmake_targets
#Execution instuctions (Currently running eNB (VNF) and UE side (PNF) on the same machine using the loopback interface)
cd cmake_targets/tools
# Loading nasmesh
source init_nas_nos1
# Add a new loopback interface address
sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up
......
This diff is collapsed.
This diff is collapsed.
21591FA00404200602013D2C3FAC50083A101700300007888000080102900E08484A0202020000000000605A0AA1A3BB4B932B632B9B982808A0A0A322805FB007888000080891A2B3C353E0FA897844866E926E0D80100021F756A900
5040040300010000001C1650902080850000
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment