Linux用make编译时提醒memcmp在此作用域中尚未声明

代码在下面。报错如图:

#ifndef special_h
#define special_h
#include <string>
#include <map>
using namespace std;
#include "Packet.h"
#include "FieldType.h"
#include "DataProcessor.h"
namespace tcpmkpub {
class SpecialCase {
public:
virtual ~SpecialCase() {}
virtual bool operator()(DATA_PROCESSOR_ARGS) const = 0;
};
typedef pair<FieldType, double> FieldTimestamp;
extern map<FieldTimestamp, const SpecialCase *> special_cases;
extern void init_special_cases();
static inline bool check_special_case(FieldType field, DATA_PROCESSOR_ARGS)
{
// DebugMsg("%.6f check special case: field = %d, offset = %d",
// pkt_in->Timestamp(), field, offset_in);
bool wildcard_timestamp = false;
FieldTimestamp ind(field, pkt_in->Timestamp());
map<FieldTimestamp, const SpecialCase *>::const_iterator it;
it = special_cases.find(ind);
if ( it == special_cases.end() )
{
ind = FieldTimestamp(field, 0);
it = special_cases.find(ind);
if ( it == special_cases.end() )
return false;
wildcard_timestamp = true;
}
if ( (*it->second)(data_name, start, caplen,
offset_in, len, offset_out,
pkt_in, pkt_out) )
{
Note("special case processed at %s %.6f field %d",
input_filename, pkt_in->Timestamp(), field);
return true;
}
else
{
if ( ! wildcard_timestamp )
Alert("special case checking failed at field %d", field);
return false;
}
}
class SpecialCaseString : public SpecialCase
{
public:
SpecialCaseString(string s)
: str(s) {}
bool operator()(DATA_PROCESSOR_ARGS) const
{
if ( ! check(start, offset_in, len, caplen) )
return false;
len = str.length();
pkt_out->dump(start + offset_in, len, offset_out);
offset_in += len;
offset_out += len;
return true;
}
protected:
bool check(const u_char *start,
int offset_in, int len, int caplen) const
{
if ( len == VARLEN || len >= (int) str.length() )
len = str.length();
else
{
Alert("SpecialCaseString insufficient data: %d < %d",
len, str.length());
return false;
}
if ( offset_in + len > caplen )
{
Alert("SpecialCaseString out of bound: %d + %d > %d",
offset_in, len, caplen);
return false;
}
if ( memcmp(start + offset_in, str.c_str(), len) != 0 )
{
Alert("SpecialCaseString content mismatch");
return false;
}
else
return true;
}
string str;
};
class SpecialCaseIPAddr : public SpecialCase
{
public:
SpecialCaseIPAddr(string s)
{
in_addr_t a = to_addr(s.c_str());
for ( int i = 3; i >= 0; --i )
{
ip[i] = a & 0xff;
a = a >> 8;
}
}
bool operator()(DATA_PROCESSOR_ARGS) const
{
if ( len != sizeof(ip) || offset_in + len > caplen )
return false;
if ( memcmp(start + offset_in, ip, sizeof(ip)) != 0 )
return false;
pkt_out->dump(ip, sizeof(ip), offset_out);
offset_in += len;
offset_out += len;
return true;
}
protected:
unsigned char ip[4];
};
} // namespace tcpmkpub
#endif /* special_h */
相关推荐
嵌入式学习笔记1.1.pdf
嵌入式、linux、C、C++、QT、Sqlit3、系统移植、驱动开发。。。。等等
海I鸥・群・发・器・免・费・版・【v2.7.4】.apk
海I鸥・群・发・器・免・费・版・【v2.7.4】.apk
【AI+区块链】EVMbench 技术解剖-一个 LLM Agent 智能合约漏洞检测 Harness 的工程架构与代码实现
【AI+区块链】EVMbench 技术解剖-一个 LLM Agent 智能合约漏洞检测 Harness 的工程架构与代码实现
CSDN首页 发布文章 CSDN同步助手 优化调度基于改进遗传算法求解带时间窗约束多卫星任务规划(Matlab代码实现) 41 100 摘要:会在推荐、列表等场景外露,帮助读者快速了解内
内容概要:本文聚焦于包含地面无人车(UGV)和无人机(UAV)的异构混合阶多智能体系统,研究其在动态与静态场景下的一致性控制问题。通过Matlab代码实现,系统地探讨了具有不同动力学特性与状态维度的智能体之间的协同控制策略,重点解决了异构系统中因模型差异带来的协调与一致性收敛难题。研究内容涵盖系统建模、一致性协议设计、李雅普诺夫稳定性分析以及在静态固定拓扑和动态切换拓扑结构下的仿真实验验证,充分展示了所提控制算法在确保多智能体系统状态一致方面的有效性、鲁棒性与时变环境适应能力。; 适合人群:具备自动控制理论、多智能体系统、机器人学或相关领域背景,熟悉Matlab编程与控制系统仿真的研究生、科研人员及工程技术人员。; 使用场景及目标:① 学习和掌握异构多智能体系统的一致性控制理论与实现方法;② 研究动态与静态网络拓扑对系统协同性能的影响;③ 为无人系统集群(如UGV-UAV协同侦察、编队飞行)的控制算法开发提供理论依据与代码参考。; 阅读建议:建议读者结合控制理论基础知识,深入理解文中提出的协议设计原理与稳定性证明过程,并动手运行和调试所提供的Matlab代码,通过调整参数和拓扑结构来观察系统行为,以达到理论与实践相结合的学习效果。
锚杆钻车操作与支护技术手册(含支护参数).docx
锚杆钻车操作与支护技术手册(含支护参数)


