Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • pasolini/openairinterface5g
  • odukan/openairinterface5g
  • ewa/openairinterface5g
  • deksprime/openairinterface5g
  • jackokie/openairinterface5g
  • Srushti16/openairinterface5g
  • BRodolphe/openairinterface5g
  • kramantas/openairinterface5g
  • suraj_4g5g/openairinterface5g
  • turletti/openairinterface5g
  • anandriisc/openairinterface5g
  • lvguorong/openairinterface5g
  • dast/openairinterface5g
  • yashwanthr/openairinterface5g
  • ajiti2tb/openairinterface5g
  • qzhou/openairinterface5g
  • nickmxxx/openairinterface5g
  • bin_he4/openairinterface5g
  • delarco/openairinterface5g
  • limx1980/openairinterface5g
  • Aniq/openairinterface5g
  • yassir63/openairinterface5g
  • orc318/openairinterface5g
  • vader/openairinterface5g
  • limx59/openairinterface5g
  • nadavaati_12345/openairinterface5g
  • jenshz/openairinterface5g
  • kuldeep/openairinterface5g
  • lurker/openairinterface5g
  • shariat/openairinterface5g
  • Alireza.najafzadeh/openairinterface5g
  • Ling/openairinterface5g
  • EvanKrall/openairinterface5g
  • youyih/openairinterface5g
  • anindya/openairinterface5g
  • ahan/openairinterface5g
  • beraoud/openairinterface5g
  • obejarano/openairinterface5g
  • Monti/openairinterface5g
  • akhamsi/openairinterface5g
  • Worker.N/openairinterface5g
  • zhangtu/openairinterface5g
  • desouza/openairinterface5g
  • zhijun/openairinterface5g
  • sureshkumar/openairinterface5g
  • milan/openairinterface5g
  • bigbangbingo/openairinterface5g
  • platini/openairinterface5g
  • muralir-nv/openairinterface5g
  • Joshua_Zhang/openairinterface5g
  • siddharthmurali1/openairinterface5g
  • sorinros/openairinterface5g
  • elainecao/openairinterface5g
  • sneltved/openairinterface5g
  • aikaterini.trilyraki/openairinterface5g
  • wujunning11/openairinterface5g
  • magounak/openairinterface5g
  • ycl1729020039/openairinterface5g
  • mayukhweb/openairinterface5g
  • wataru/openairinterface5g
  • afonsoli/openairinterface5g
  • ppokar/openairinterface5g
  • emest/openairinterface5g
  • Najib/openairinterface5g
  • liqing/openairinterface5g
  • gprshome/openairinterface5g
  • Dvevgedveccc/openairinterface5g
  • Elena_Lukashova/openairinterface5g
  • imaneouss/openairinterface5g
  • yangyuan/openairinterface5g
  • ycliang/openairinterface5g
  • rohanfds/openairinterface5g
  • cong2008abc/openairinterface5g
  • Giovanni/openairinterface5g
  • willvegapunk/openairinterface5g
  • Chen/openairinterface5g
  • Ella/openairinterface5g
  • kollabalu/openairinterface5g
  • tsaichanglan/openairinterface5g
  • Artifice/openairinterface5g
  • HJR0129/openairinterface5g
  • alextp/openairinterface5g
  • Changron/openairinterface5g
  • pedosb/openairinterface5g
  • Flozzen/openairinterface5g
  • hobei/openairinterface5g
  • WP_Jing/openairinterface5g
  • reset4/openairinterface5g
  • alexjoseph/openairinterface5g
  • latuan1710/openairinterface5g
  • wynter-wang/openairinterface5g
  • stt12706/openairinterface5g
  • sy/openairinterface5g
  • dzxu/openairinterface5g
  • ptizoom/openairinterface5g
  • Thierry/openairinterface5g
  • tjamc80/openairinterface5g
  • yenmuse/openairinterface5g
  • archerling/openairinterface5g
  • grahul/openairinterface5g
  • ashish.shri/openairinterface5g
  • TianyuChen/openairinterface5g
  • cuixf1/openairinterface5g
  • Jan/openairinterface5g
  • jboatenng/openairinterface5g_gpio
  • geokal/openairinterface5g
  • johannhg/openairinterface5g
  • TofunmiA/openairinterface5g
  • razvanursu/openairinterface5g-mac-scheduling
  • Julio/openairinterface5g
  • fredrichx/openairinterface5g
  • nems/openairinterface5g
  • wb_li/openairinterface5g
  • ferrieux/openairinterface5g
  • prajna_g/openairinterface-5-g-xnap-ho
  • mtinasc/openairinterface5g
  • Hofschroeer/openairinterface5g
  • buptxiaofeng/openairinterface5g
  • fjgh_759/openairinterface5g
  • calcel/openairinterface5g
  • Reem/openairinterface5g
  • havar_mind/openairinterface5g
  • shrinish/openairinterface5g
  • YANGHELINDE/openairinterface5g
  • lool/openairinterface5g
  • raghav1900/openairinterface5g
  • allan1201/openairinterface5g
  • ferris/openairinterface5g
  • seanzw/openairinterface5g
  • emad72/openairinterface5g
  • guojilong123/openairinterface5g
  • Rony99/openairinterface5g
  • lity/openairinterface5g
  • sshrivastava/openairinterface5g
  • zhihengzhang/openairinterface5g
  • Rakesh_B_B/openairinterface5g
  • baleeiro/openairinterface5g
  • 19125064/openairinterface5g
  • linlin/openairinterface5g
  • NA1VE/openairinterface5g
  • oai1B/openairinterface5g
  • daveprice/openairinterface5g
  • mo/openairinterface5g
  • dhanmeet/openairinterface5g
  • mv2290/openairinterface-5-g-test
  • pagmatt/openairinterface5g
  • mmTestNYU/openairinterface5g
  • mmezzavilla/openairinterface5g
  • sudhakarb/openairinterface5g
  • mekki/openairinterface5g
  • virtanen/openairinterface5g
  • dyyu/openairinterface5g
  • mohammed_safwan/openairinterface5g
  • venkat/openairinterface5g
  • rupadhya/openairinterface5g
  • adjou/openairinterface5g
  • samiemostafavi/openairinterface5g-edaf
  • oliverxsch/openairinterface5g
  • Simewu/openairinterface5g
  • Sreeram/openairinterface5g
  • oai/openairinterface5g
161 results
Show changes
Commits on Source (1)
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "platform_constants.h" #include "platform_constants.h"
#include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/LOG/vcd_signal_dumper.h"
#include "msc.h" #include "msc.h"
#include "UTIL/OPT/opt.h"
#if defined(ENABLE_SECURITY) #if defined(ENABLE_SECURITY)
# include "UTIL/OSA/osa_defs.h" # include "UTIL/OSA/osa_defs.h"
...@@ -356,6 +357,13 @@ boolean_t pdcp_data_req( ...@@ -356,6 +357,13 @@ boolean_t pdcp_data_req(
LOG_F(PDCP,"\n"); LOG_F(PDCP,"\n");
#endif #endif
if (opt_enabled ==1) {
trace_pdcp_pdu(0 /*uplink*/, ctxt_pP->module_id /*ueid*/, pdcp_pdu_p->data, pdcp_pdu_size,
srb_flagP?1/*DCCH*/:0/*reserved*/, 2/*DLSCH*/, srb_flagP?1/*SIGNALING_PLANE*/:2/*USER_PLANE*/, 12 /*12 bits SN*/, 0 /*with header*/);
LOG_D(RLC,"[UE %d][SRB] trace uplink PDCP PDU with size %d\n", ctxt_pP->module_id, pdcp_pdu_size);
}
rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
} }
...@@ -537,6 +545,13 @@ pdcp_data_ind( ...@@ -537,6 +545,13 @@ pdcp_data_ind(
*/ */
if (MBMS_flagP == 0 ) { if (MBMS_flagP == 0 ) {
if (opt_enabled ==1) {
trace_pdcp_pdu(1 /*downlink*/, (uint16_t)(pthread_self() & 0xffff) /*ctxt_pP->module_id*/ /*ueid*/, sdu_buffer_pP->data, sdu_buffer_sizeP,
srb_flagP?1/*DCCH*/:0/*reserved*/, 2/*DLSCH*/, srb_flagP?1/*SIGNALING_PLANE*/:2/*USER_PLANE*/, pdcp_p->seq_num_size, 0 /*with header*/);
LOG_D(RLC,"[UE %d][SRB] trace downlink PDCP PDU with size %d\n", ctxt_pP->module_id, sdu_buffer_sizeP);
}
if (srb_flagP) { //SRB1/2 if (srb_flagP) { //SRB1/2
pdcp_header_len = PDCP_CONTROL_PLANE_DATA_PDU_SN_SIZE; pdcp_header_len = PDCP_CONTROL_PLANE_DATA_PDU_SN_SIZE;
pdcp_tailer_len = PDCP_CONTROL_PLANE_DATA_PDU_MAC_I_SIZE; pdcp_tailer_len = PDCP_CONTROL_PLANE_DATA_PDU_MAC_I_SIZE;
......
...@@ -62,6 +62,7 @@ extern int otg_enabled; ...@@ -62,6 +62,7 @@ extern int otg_enabled;
#include "UTIL/OTG/otg_tx.h" #include "UTIL/OTG/otg_tx.h"
#include "UTIL/FIFO/pad_list.h" #include "UTIL/FIFO/pad_list.h"
#include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "platform_constants.h" #include "platform_constants.h"
#include "msc.h" #include "msc.h"
...@@ -240,6 +241,12 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -240,6 +241,12 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
bytes_wrote = rtf_put (PDCP2PDCP_USE_RT_FIFO, &(sdu->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write); bytes_wrote = rtf_put (PDCP2PDCP_USE_RT_FIFO, &(sdu->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write);
#else #else
if (opt_enabled ==1) {
trace_pdcp_pdu(1 /*downlink*/, (uint16_t)(pthread_self() & 0xffff) /*ctxt_pP->module_id*/ /*ueid*/, &(sdu_p->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write,
0/*reserved*/, 2/*DLSCH*/, 2/*USER_PLANE*/, 12, 1 /*no header*/);
LOG_D(RLC,"[UE %d][SRB] trace downlink PDCP SDU with size %d\n", ctxt_pP->module_id, ((pdcp_data_ind_header_t *)(sdu_p->data))->data_size);
}
#ifdef PDCP_USE_NETLINK #ifdef PDCP_USE_NETLINK
#ifdef LINUX #ifdef LINUX
memcpy(NLMSG_DATA(nas_nlh_tx)+sizeof(pdcp_data_ind_header_t), &(sdu_p->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write); memcpy(NLMSG_DATA(nas_nlh_tx)+sizeof(pdcp_data_ind_header_t), &(sdu_p->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write);
......
...@@ -84,6 +84,9 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size, ...@@ -84,6 +84,9 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
int ueid, int rntiType, int rnti, uint16_t sysFrame, uint8_t subframe, int ueid, int rntiType, int rnti, uint16_t sysFrame, uint8_t subframe,
int oob_event, int oob_event_value); int oob_event, int oob_event_value);
void trace_pdcp_pdu(int direction, uint16_t ueid, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
int channelType, int BCCHTransport, int plane, uint8_t seqnum_length, uint8_t no_header_pdu);
int init_opt(char *path, char *ip, char *port, radio_type_t radio_type_p); int init_opt(char *path, char *ip, char *port, radio_type_t radio_type_p);
void terminate_opt(void); void terminate_opt(void);
......
/* packet-pdcp-lte.h
*
* Martin Mathieson
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "packet-rohc.h"
/* Direction */
#define DIRECTION_UPLINK 0
#define DIRECTION_DOWNLINK 1
enum pdcp_plane
{
SIGNALING_PLANE = 1,
USER_PLANE = 2
};
typedef enum LogicalChannelType
{
Channel_DCCH=1,
Channel_BCCH=2,
Channel_CCCH=3,
Channel_PCCH=4,
Channel_DCCH_NB=5,
Channel_BCCH_NB=6,
Channel_CCCH_NB=7,
Channel_PCCH_NB=8
} LogicalChannelType;
typedef enum
{
BCH_TRANSPORT=1,
DLSCH_TRANSPORT=2
} BCCHTransportType;
#define PDCP_SN_LENGTH_5_BITS 5
#define PDCP_SN_LENGTH_7_BITS 7
#define PDCP_SN_LENGTH_12_BITS 12
#define PDCP_SN_LENGTH_15_BITS 15
#define PDCP_SN_LENGTH_18_BITS 18
enum security_integrity_algorithm_e { eia0, eia1, eia2, eia3 };
enum security_ciphering_algorithm_e { eea0, eea1, eea2, eea3 };
#if 0
typedef struct pdcp_security_info_t
{
guint32 configuration_frame;
gboolean seen_next_ul_pdu; /* i.e. have we seen SecurityModeResponse */
enum security_integrity_algorithm_e integrity;
enum security_ciphering_algorithm_e ciphering;
/* Store previous settings so can revert if get SecurityModeFailure */
guint32 previous_configuration_frame;
enum security_integrity_algorithm_e previous_integrity;
enum security_ciphering_algorithm_e previous_ciphering;
} pdcp_security_info_t;
/* Info attached to each LTE PDCP/RoHC packet */
typedef struct pdcp_lte_info
{
/* Channel info is needed for RRC parsing */
guint8 direction;
guint16 ueid;
LogicalChannelType channelType;
guint16 channelId;
BCCHTransportType BCCHTransport;
/* Details of PDCP header */
gboolean no_header_pdu;
enum pdcp_plane plane;
guint8 seqnum_length;
/* RoHC settings */
rohc_info rohc;
guint8 is_retx;
} pdcp_lte_info;
#endif
/*****************************************************************/
/* UDP framing format */
/* ----------------------- */
/* Several people have asked about dissecting PDCP by framing */
/* PDUs over IP. A suggested format over UDP has been defined */
/* and implemented by this dissector, using the definitions */
/* below. A link to an example program showing you how to encode */
/* these headers and send LTE PDCP PDUs on a UDP socket is */
/* provided at https://wiki.wireshark.org/PDCP-LTE */
/* */
/* A heuristic dissecter (enabled by a preference) will */
/* recognise a signature at the beginning of these frames. */
/* Until someone is using this format, suggestions for changes */
/* are welcome. */
/*****************************************************************/
/* Signature. Rather than try to define a port for this, or make the
port number a preference, frames will start with this string (with no
terminating NULL */
#define PDCP_LTE_START_STRING "pdcp-lte"
/* Fixed fields. This is followed by the following 3 mandatory fields:
- no_header_pdu (1 byte)
- plane (1 byte)
- rohc_compression ( byte)
(where the allowed values are defined above) */
/* Conditional field. This field is mandatory in case of User Plane PDCP PDU.
The format is to have the tag, followed by the value (there is no length field,
it's implicit from the tag). The allowed values are defined above. */
#define PDCP_LTE_SEQNUM_LENGTH_TAG 0x02
/* 1 byte */
/* Optional fields. Attaching this info to frames will allow you
to show you display/filter/plot/add-custom-columns on these fields, so should
be added if available.
The format is to have the tag, followed by the value (there is no length field,
it's implicit from the tag) */
#define PDCP_LTE_DIRECTION_TAG 0x03
/* 1 byte */
#define PDCP_LTE_LOG_CHAN_TYPE_TAG 0x04
/* 1 byte */
#define PDCP_LTE_BCCH_TRANSPORT_TYPE_TAG 0x05
/* 1 byte */
#define PDCP_LTE_ROHC_IP_VERSION_TAG 0x06
/* 2 bytes, network order */
#define PDCP_LTE_ROHC_CID_INC_INFO_TAG 0x07
/* 1 byte */
#define PDCP_LTE_ROHC_LARGE_CID_PRES_TAG 0x08
/* 1 byte */
#define PDCP_LTE_ROHC_MODE_TAG 0x09
/* 1 byte */
#define PDCP_LTE_ROHC_RND_TAG 0x0A
/* 1 byte */
#define PDCP_LTE_ROHC_UDP_CHECKSUM_PRES_TAG 0x0B
/* 1 byte */
#define PDCP_LTE_ROHC_PROFILE_TAG 0x0C
/* 2 bytes, network order */
#define PDCP_LTE_CHANNEL_ID_TAG 0x0D
/* 2 bytes, network order */
#define PDCP_LTE_UEID_TAG 0x0E
/* 2 bytes, network order */
/* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU
continues until the end of the frame) */
#define PDCP_LTE_PAYLOAD_TAG 0x01
#if 0
/* Called by RRC, or other configuration protocols */
/* Function to configure ciphering & integrity algorithms */
void set_pdcp_lte_security_algorithms(guint16 ueid, pdcp_security_info_t *security_info);
/* Function to indicate securityModeCommand did not complete */
void set_pdcp_lte_security_algorithms_failed(guint16 ueid);
/* Called by external dissectors */
void set_pdcp_lte_rrc_ciphering_key(guint16 ueid, const char *key);
void set_pdcp_lte_rrc_integrity_key(guint16 ueid, const char *key);
void set_pdcp_lte_up_ciphering_key(guint16 ueid, const char *key);
#endif
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
/* packet-rohc.h
* Routines for RObust Header Compression (ROHC) dissection.
*
* Copyright 2011, Anders Broman <anders.broman[at]ericsson.com>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Ref:
* http://www.ietf.org/rfc/rfc3095.txt RObust Header Compression (ROHC): Framework and four profiles: RTP, UDP, ESP, and uncompressed
* http://datatracker.ietf.org/doc/rfc4815/ RObust Header Compression (ROHC): Corrections and Clarifications to RFC 3095
* http://datatracker.ietf.org/doc/rfc5225/ RObust Header Compression Version 2 (ROHCv2): Profiles for RTP, UDP, IP, ESP and UDP-Lite
*/
#ifndef PACKET_ROHC_H
#define PACKET_ROHC_H
#define MAX_CID 15
enum rohc_mode
{
MODE_NOT_SET = 0,
UNIDIRECTIONAL = 1,
OPTIMISTIC_BIDIRECTIONAL = 2,
RELIABLE_BIDIRECTIONAL = 3
};
enum rohc_d_mode
{
NO_CONTEXT = 1,
STATIC_CONTEXT = 2,
FULL_CONTEXT = 3
};
#if 0
typedef struct rohc_info
{
gboolean rohc_compression;
guint16 rohc_ip_version;
gboolean cid_inclusion_info;
gboolean large_cid_present;
enum rohc_mode mode;
gboolean rnd;
gboolean udp_checksum_present;
guint16 profile;
proto_item *last_created_item;
} rohc_info;
typedef struct rohc_context
{
guint16 rohc_ip_version[MAX_CID+1];
gboolean large_cid_present[MAX_CID+1];
enum rohc_mode mode[MAX_CID+1];
enum rohc_d_mode d_mode[MAX_CID+1];
gboolean rnd[MAX_CID+1];
gboolean udp_checkum_present[MAX_CID+1];
guint16 profile[MAX_CID+1];
gboolean rohc_context_init[MAX_CID+1];
gint ir_frame_number[MAX_CID+1]; /* The frame number of the last IR packet seen */
} rohc_context;
#endif
#endif /* PACKET_ROHC_H */
...@@ -97,12 +97,14 @@ int opt_enabled=0; ...@@ -97,12 +97,14 @@ int opt_enabled=0;
#define PACKET_MAC_LTE_DEFAULT_UDP_PORT (9999) #define PACKET_MAC_LTE_DEFAULT_UDP_PORT (9999)
typedef int gint;
typedef uint8_t guint8; typedef uint8_t guint8;
typedef uint16_t guint16; typedef uint16_t guint16;
typedef uint32_t guint32; typedef uint32_t guint32;
typedef guint8 gboolean; typedef guint8 gboolean;
#include "packet-mac-lte.h" #include "packet-mac-lte.h"
#include "packet-pdcp-lte.h"
#include "mac_pcap.h" #include "mac_pcap.h"
//static unsigned char g_PDUBuffer[1600]; //static unsigned char g_PDUBuffer[1600];
...@@ -134,6 +136,14 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType, ...@@ -134,6 +136,14 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
guint8 oob_event, guint8 oob_event_value, guint8 oob_event, guint8 oob_event_value,
uint8_t *pdu_buffer, unsigned int pdu_buffer_size); uint8_t *pdu_buffer, unsigned int pdu_buffer_size);
static void SendPDCPFrame(guint8 direction, guint16 ueid, LogicalChannelType channelType,
BCCHTransportType BCCHTransport, gboolean no_header_pdu,
enum pdcp_plane plane, guint8 seqnum_length, gboolean rohc_compression,
unsigned short rohc_ip_version, gboolean cid_inclusion_info,
gboolean large_cid_present, enum rohc_mode mode,
gboolean rnd, gboolean udp_checkum_present, unsigned short profile,
uint8_t *pdu_buffer, unsigned int pdu_buffer_size);
static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context, static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
const unsigned char *PDU, unsigned int length); const unsigned char *PDU, unsigned int length);
...@@ -366,6 +376,122 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType, ...@@ -366,6 +376,122 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
} }
} }
/*******************************************/
/* Add framing header to PDCP PDU and send. */
static void SendPDCPFrame(guint8 direction, guint16 ueid, LogicalChannelType channelType,
BCCHTransportType BCCHTransport, gboolean no_header_pdu,
enum pdcp_plane plane, guint8 seqnum_length, gboolean rohc_compression,
unsigned short rohc_ip_version, gboolean cid_inclusion_info,
gboolean large_cid_present, enum rohc_mode mode,
gboolean rnd, gboolean udp_checkum_present, unsigned short profile,
uint8_t *pdu_buffer, unsigned int pdu_buffer_size)
{
#ifdef JUMBO_FRAME
static unsigned char frameBuffer[9000];
#else
static unsigned char frameBuffer[1600];
#endif
static unsigned int frameOffset;
ssize_t bytesSent;
frameOffset = 0;
unsigned short tmp16;
/********************************************************************/
/* Fixed start to each frame (allowing heuristic dissector to work) */
/* Not NULL terminated */
memcpy(frameBuffer+frameOffset, PDCP_LTE_START_STRING,
strlen(PDCP_LTE_START_STRING));
frameOffset += strlen(PDCP_LTE_START_STRING);
/*******************************************************************************/
/* Now write out fixed fields (the mandatory elements of struct pdcp_lte_info) */
frameBuffer[frameOffset++] = no_header_pdu;
frameBuffer[frameOffset++] = plane;
frameBuffer[frameOffset++] = rohc_compression;
/*************************************/
/* Now conditional fields */
/* Seq Num Length */
if (plane == USER_PLANE) {
frameBuffer[frameOffset++] = PDCP_LTE_SEQNUM_LENGTH_TAG;
frameBuffer[frameOffset++] = seqnum_length;
}
/*************************************/
/* Now optional fields */
/* Direction */
frameBuffer[frameOffset++] = PDCP_LTE_DIRECTION_TAG;
frameBuffer[frameOffset++] = direction;
/* Logical Channel Type */
frameBuffer[frameOffset++] = PDCP_LTE_LOG_CHAN_TYPE_TAG;
frameBuffer[frameOffset++] = channelType;
/* BCCH Transport Type */
frameBuffer[frameOffset++] = PDCP_LTE_BCCH_TRANSPORT_TYPE_TAG;
frameBuffer[frameOffset++] = BCCHTransport;
/* RoHC IP Version */
frameBuffer[frameOffset++] = PDCP_LTE_ROHC_IP_VERSION_TAG;
tmp16 = htons(rohc_ip_version);
memcpy(frameBuffer+frameOffset, &tmp16, 2);
frameOffset += 2;
/* UEid */
frameBuffer[frameOffset++] = PDCP_LTE_UEID_TAG;
tmp16 = htons(ueid);
memcpy(frameBuffer+frameOffset, &tmp16, 2);
frameOffset += 2;
/* RoHC Cid Inclusion Info */
frameBuffer[frameOffset++] = PDCP_LTE_ROHC_CID_INC_INFO_TAG;
frameBuffer[frameOffset++] = cid_inclusion_info;
/* RoHC Large Cid Present */
frameBuffer[frameOffset++] = PDCP_LTE_ROHC_LARGE_CID_PRES_TAG;
frameBuffer[frameOffset++] = large_cid_present;
/* RoHC Mode */
frameBuffer[frameOffset++] = PDCP_LTE_ROHC_MODE_TAG;
frameBuffer[frameOffset++] = mode;
/* RoHC Rand */
frameBuffer[frameOffset++] = PDCP_LTE_ROHC_RND_TAG;
frameBuffer[frameOffset++] = rnd;
/* RoHC UDP Checksum Present */
frameBuffer[frameOffset++] = PDCP_LTE_ROHC_UDP_CHECKSUM_PRES_TAG;
frameBuffer[frameOffset++] = udp_checkum_present;
/* RoHC Profile */
frameBuffer[frameOffset++] = PDCP_LTE_ROHC_PROFILE_TAG;
tmp16 = htons(profile);
memcpy(frameBuffer+frameOffset, &tmp16, 2);
frameOffset += 2;
/***************************************/
/* Now write the PDCP PDU */
frameBuffer[frameOffset++] = PDCP_LTE_PAYLOAD_TAG;
/* Append actual PDU */
//memcpy(frameBuffer+frameOffset, g_PDUBuffer, g_PDUOffset);
//frameOffset += g_PDUOffset;
memcpy(frameBuffer+frameOffset, pdu_buffer, pdu_buffer_size);
frameOffset += pdu_buffer_size;
/* Send out the data over the UDP socket */
bytesSent = sendto(g_socksd, frameBuffer, frameOffset, 0,
(const struct sockaddr*)&g_serv_addr, sizeof(g_serv_addr));
if (bytesSent != frameOffset) {
LOG_W(OPT, "sendto() failed (not a thread-safe func)- expected %d bytes, got %d (errno=%d)\n",
frameOffset, bytesSent, errno);
//exit(1);
}
}
/* Write an individual PDU (PCAP packet header + mac-context + mac-pdu) */ /* Write an individual PDU (PCAP packet header + mac-context + mac-pdu) */
static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context, static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
const uint8_t *PDU, unsigned int length) const uint8_t *PDU, unsigned int length)
...@@ -480,6 +606,33 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size, ...@@ -480,6 +606,33 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
} }
} }
/*---------------------------------------------------*/ /*---------------------------------------------------*/
void trace_pdcp_pdu(int direction, uint16_t ueid, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
int channelType, int BCCHTransport, int plane, uint8_t seqnum_length, uint8_t no_header_pdu)
{
switch (opt_type) {
case OPT_WIRESHARK :
if (g_socksd == -1) {
return;
}
SendPDCPFrame((guint8)direction, (guint16)ueid, (LogicalChannelType)channelType, (BCCHTransportType)BCCHTransport,
(gboolean)no_header_pdu, (enum pdcp_plane)plane, (guint8)seqnum_length, 0, 0, 0, 0, 1, 0, 0, 0,
pdu_buffer, pdu_buffer_size);
break;
case OPT_PCAP:
if (file_fd == NULL) {
return;
}
LOG_I(OPT, "No implementation!\n");
break;
case OPT_TSHARK:
default:
break;
}
}
/*---------------------------------------------------*/
int init_opt(char *path, char *ip, char *port, radio_type_t radio_type_p) int init_opt(char *path, char *ip, char *port, radio_type_t radio_type_p)
{ {
uint16_t in_port; uint16_t in_port;
......