之前的預期「)」我有這樣的代碼:錯誤:「包」
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’
我真的不知道如何解決這些問題,我檢查了parens已經匹配了。
「honeypot_command_packet」定義在哪裏? –
您的示例中沒有行號,很難說清楚。此外,還有關於您正在使用的類型的信息。請發佈一個展示失敗的簡單例子。 –
這些只有88行,對吧?我可能錯過了一兩次,但沒有更多。 – usr2564301