srsLTE源码学习:RLC,无线链路控制子层抓包rlc_pcap.h,rlc_pcap.cc
RLC,无线链路控制子层
RLC(Radio Link Control,无线链路层控制协议)是GPRS/WCDMA/TD-SCDMA/LTE 等无线通信系统中的无线链路控制层协议。在WCDMA系统中,RLC层位于MAC层之上,属于L2的一部分,为用户和控制数据提供分段和重传业务。
rlc_pcap.h
lib\include\srslte\common 1859 4/11/2019 1
/**** \section COPYRIGHT** Copyright 2013-2015 Software Radio Systems Limited** \section LICENSE** This file is part of the srsUE library.** srsUE is free software: you can redistribute it and/or modify* it under the terms of the GNU Affero General Public License as* published by the Free Software Foundation, either version 3 of* the License, or (at your option) any later version.** srsUE 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 Affero General Public License for more details.** A copy of the GNU Affero General Public License can be found in* the LICENSE file in the top-level directory of this distribution* and at http://www.gnu.org/licenses/.* RLC,无线链路控制子层。*/#ifndef RLCPCAP_H
#define RLCPCAP_H#include <stdint.h>
#include "srslte/common/pcap.h"namespace srslte {//RLC,无线链路控制子层。
class rlc_pcap
{
public: rlc_pcap() {enable_write=false; ue_id=0; pcap_file = NULL; };void enable(bool en);void open(const char *filename, uint32_t ue_id = 0);void close();void set_ue_id(uint16_t ue_id);void write_dl_am_ccch(uint8_t* pdu, uint32_t pdu_len_bytes);void write_ul_am_ccch(uint8_t* pdu, uint32_t pdu_len_bytes);private:bool enable_write; FILE *pcap_file; uint32_t ue_id;void pack_and_write(uint8_t* pdu,uint32_t pdu_len_bytes,uint8_t mode,uint8_t direction,uint8_t priority,uint8_t seqnumberlength,uint16_t ueid,uint16_t channel_type,uint16_t channel_id);
};} // namespace srsue#endif // RLCPCAP_H
rlc_pcap.cc
lib\src\common 2720 2/28/2019 44
/**** \section COPYRIGHT** Copyright 2013-2015 Software Radio Systems Limited** \section LICENSE** This file is part of the srsUE library.** srsUE is free software: you can redistribute it and/or modify* it under the terms of the GNU Affero General Public License as* published by the Free Software Foundation, either version 3 of* the License, or (at your option) any later version.** srsUE 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 Affero General Public License for more details.** A copy of the GNU Affero General Public License can be found in* the LICENSE file in the top-level directory of this distribution* and at http://www.gnu.org/licenses/.**/#include <stdint.h>
#include "srslte/srslte.h"
#include "srslte/common/pcap.h"
#include "srslte/common/rlc_pcap.h"namespace srslte {void rlc_pcap::enable(bool en)
{enable_write = true;
}
void rlc_pcap::open(const char* filename, uint32_t ue_id)
{fprintf(stdout, "Opening RLC PCAP with DLT=%d\n", RLC_LTE_DLT);pcap_file = LTE_PCAP_Open(RLC_LTE_DLT, filename);this->ue_id = ue_id;enable_write = true;
}
void rlc_pcap::close()
{fprintf(stdout, "Saving RLC PCAP file\n");LTE_PCAP_Close(pcap_file);
}void rlc_pcap::set_ue_id(uint16_t ue_id) {this->ue_id = ue_id;
}void rlc_pcap::pack_and_write(uint8_t* pdu, uint32_t pdu_len_bytes, uint8_t mode, uint8_t direction, uint8_t priority, uint8_t seqnumberlength, uint16_t ueid, uint16_t channel_type, uint16_t channel_id)
{if (enable_write) {RLC_Context_Info_t context;context.rlcMode = mode;context.direction = direction;context.priority = priority;context.sequenceNumberLength = seqnumberlength;context.ueid = ueid;context.channelType = channel_type;context.channelId = channel_id;context.pduLength = pdu_len_bytes;if (pdu) {LTE_PCAP_RLC_WritePDU(pcap_file, &context, pdu, pdu_len_bytes);}}
}void rlc_pcap::write_dl_am_ccch(uint8_t* pdu, uint32_t pdu_len_bytes)
{uint8_t priority = 0;uint8_t seqnumberlength = 0; // normal length of 10bituint8_t channel_id = 0;pack_and_write(pdu, pdu_len_bytes, RLC_AM_MODE, DIRECTION_DOWNLINK, priority, seqnumberlength, ue_id, CHANNEL_TYPE_CCCH, channel_id);
}void rlc_pcap::write_ul_am_ccch(uint8_t* pdu, uint32_t pdu_len_bytes)
{uint8_t priority = 0;uint8_t seqnumberlength = 0; // normal length of 10bituint8_t channel_id = 0;pack_and_write(pdu, pdu_len_bytes, RLC_AM_MODE, DIRECTION_UPLINK, priority, seqnumberlength, ue_id, CHANNEL_TYPE_CCCH, channel_id);
}}
srsLTE源码学习:RLC,无线链路控制子层抓包rlc_pcap.h,rlc_pcap.cc相关推荐
- srsLTE源码学习:度量中心:metrics_hub.h
Table of Contents metrics_hub.h PS:<srsLTE源码学习:绑核创建线程threads.h, threads.c> metrics_hub.h lib\i ...
- srsLTE源码学习:RRC:(Radio Resource Control):无线资源控制协议
Table of Contents rrc_asn1.h 见过一个头文件六万多行的吗? rrc_asn1.h lib\include\srslte\asn1 2074866 4/1/201 ...
- srsLTE源码学习:MAC层抓包pcap
Table of Contents pcap.h lib\include\srslte\common 13945 2/28/2019 182 mac_pcap.h lib ...
- srsLTE源码学习:S1接口抓包s1ap_pcap.h,s1ap_pcap.cc
Table of Contents 介绍 图例 代码 s1ap_pcap.h s1ap_pcap.cc s1ap_test.cc 介绍 S1接口是LTE eNodeB(基站)与 EPC(分组核心网)之 ...
- srsLTE源码学习:安全证书polarssl
Table of Contents liblte_ssl.h liblte_ssl.h lib\include\srslte\common 2101 4/8/2019 19 #ifn ...
- srsLTE源码学习:网络附属存储抓包nas_pcap.h
Table of Contents nas_pcap.h lib\include\srslte\common 667 4/10/2019 1 nas_pcap.cc li ...
- srsLTE源码学习:NAS非接入层、PDCP分组数据汇聚协议、PDU 协议数据单元 头文件
非接入层(原名NAS - Non-access stratum) 分组数据汇聚协议(PDCP - Packet Data Convergence Protocol) 协议数据单元(PDU - Prot ...
- srsLTE源码学习:GTP:GPRS Turning Protocol- GPRS隧道协议
Table of Contents gtpc.h * GTP-C v2 Header GPRS Turning Protocol <GPRS Turning Protocol> GPRS ...
- NR 5G RLC无线链路控制
RLC架构 RLC实体 1.RRC通常控制RLC配置: 2.RLC子层的功能由RLC实体执行,对于在gNB处配置的RLC实体,存在在UE处配置的对等RLC实体,反之亦然: 3.RLC实体从/向上层接收 ...
最新文章
- SSM+BJUI实现以Base64方式上传照片
- 【LeetCode】LeetCode之删除并获得点数——动态规划、排序+动态规划
- NuttX 启动流程
- 深入进货单-价格跟踪----宇然电脑公司管理软件
- 《从单体迈向 Serverless 的避坑指南》
- 为什么程序员如此“嫌弃”主干开发模式?
- 无法创建堆栈的防护页面 解决方法
- 单片机原理与应用技术(四)———矩阵键盘汇编语言
- lib库知识全面讲解(.lib、.dll)
- Norgen AAV提取剂盒说明书(含特色)
- Win10如何用微软账户自动登录电脑
- PMP/高项 项目管理培训大纲
- 5G NR协议栈及功能2 - MAC RLC PDCP SDAP
- 如何写出自媒体10W+爆文?
- JAVA实现页面上传图片或文件
- 数据库原理与设计P163习题9答案
- kickstart自动化系统安装_利用Kickstart自动化安装CentOS的教程
- excel的常用函数
- Linux定时器crontab用法
- 阿里旺旺调用谷歌Chrome浏览器打不开网页崩溃了显示错误代码 RESULT_CODE_MISSING_DATA-完美解决