gpt4 book ai didi

c - 错误: Expected ')' before 'packet'

转载 作者:行者123 更新时间:2023-11-30 20:55:51 26 4
gpt4 key购买 nike

我有这个代码:

void addSpammer(honeypot_command_packet packet){
hashtable_put(spammer_table, packet->ip_source_address_big_endian, packet);
}
void addVulnerable( honeypot_command_packet packet){
hashtable_put(vulnerable_table, packet->udp_dest_port_big_endian, packet);
}

void addEvil( honeypot_command_packet packet){
hashtable_put(evil_table, packet, packet);
}

void rmSpammer(honeypot_command_packet packet){
hashtable_remove(spammer_table, packet->ip_source_address_big_endian);
}

void rmVulnerable(honeypot_command_packet packet){
hashtable_remove(vulnerable_table, packet->udp_dest_port_big_endian);
}

void rmEvil(honeypot_command_packet packet){
hashtable_remove(evil_table, packet);
}

void print_stats(){
puts("Printing stats...");
}

void handle_packet_table(honeypot_command_packet pack){

if(pack->secret_big_endian == HONEYPOT_SECRET){

printf_m("This is a command packet %x \n", pack->cmd);

if(pack->cmd == HONEYPOT_ADD_SPAMMER){
// handle addint a spammer
addSpammer(pack);

}else if(pack->cmd == HONEYPOT_ADD_EVIL){
// handle adding an evil packet hash
addEvil(pack);

}else if(pack->cmd == HONEYPOT_ADD_VULNERABLE){
// handle addint a vunlerable port
addVulnerable(pack);

}else if(pack->cmd == HONEYPOT_DEL_SPAMMER){
// handle removing a spammer
rmSpammer(ip_source_address_big_endian);

}else if(pack->cmd == HONEYPOT_DEL_EVIL ){
//handle removing an evil packet
rmEvil(ip_source_address_big_endian);

}else if(pack->cmd == HONEYPOT_DEL_VULNERABLE ){
//handle removing a vulnurable port
rmVulnerable(udp_dest_port_big_endian);

}else if(pack->cmd == HONEYPOT_PRINT){
print_stats();
//handle printing from the packet
}else{
printf_m("there is a problem with the data field \n");
}

}
else{
// the packet is not anything
//check if it is in any of the lists then increment the number of packets processed
void* *item;
if (hashtable_get(spammer_table, pack->ip_source_address_big_endian, *item) == 0){
addSpammer(pack);
}

if (hashtable_get(vulnerable_table, pack->udp_dest_port_big_endian, *item) == 0){
addVulnerable(pack);
}

if (hashtable_get(evil_table, pack, *item) == 0){
addEvil(pack);
}
else{
hashtable_put(good_table, pack, pack);
}
}

packets_arrived++;
bytes_arrived+=sizeof(pack);
}

我收到以下错误:

network.c:94: error: expected ‘)’ before ‘packet’

network.c:98: error: expected ‘)’ before ‘packet’

network.c:102: error: expected ‘)’ before ‘packet’

network.c:106: error: expected ‘)’ before ‘packet’

network.c:110: error: expected ‘)’ before ‘packet’

network.c:114: error: expected ‘)’ before ‘packet’

network.c:122: error: expected ‘)’ before ‘pack’

我不太确定如何解决这些问题,我检查了括号是否已经匹配。

最佳答案

问题是您正在尝试使用 honeypot_command_packet 类型,但您之前显然没有定义该类型。也许您缺少所需的 #include,或者类型需要限定为 some_namespace::hoenypot_command_packet

关于c - 错误: Expected ')' before 'packet' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30144166/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com