#include "../config.h"#include "../engine/hlbr.h"Go to the source code of this file.
| #define INTERFACE_BROADCAST 99 |
Definition at line 28 of file packet.h.
Referenced by HandleARPPacket(), RouteARP(), RouteBroadcast(), RouteMacFilter(), and WritePacket().
| #define INTERFACE_NONE -1 |
| #define PACKET_NONE -1 |
Definition at line 42 of file packet.h.
Referenced by PopFromPending(), ProcessPacketThread(), and SendARP().
| #define PACKET_PROTO_ETHERNET 2 |
Definition at line 23 of file packet.h.
Referenced by DecodeEthernet(), GetPacketProtoByName(), and ParseInterface().
| #define PACKET_PROTO_NONE 0 |
| #define PACKET_ROLE_EXTERNAL 1 |
| #define PACKET_ROLE_HONEY 3 |
| #define PACKET_ROLE_INTERNAL 2 |
| #define PACKET_ROLE_NORMAL 0 |
| #define PACKET_STATUS_ALLOCATED 3 |
| #define PACKET_STATUS_BLOCKED 5 |
Definition at line 35 of file packet.h.
Referenced by BlockPacket(), DropAction(), and ProcessPacket().
| #define PACKET_STATUS_IDLE 0 |
| #define PACKET_STATUS_PENDING 1 |
| #define PACKET_STATUS_PROCESSING 4 |
| #define PACKET_TYPE_LINUX_RAW 1 |
Definition at line 14 of file packet.h.
Referenced by GetPacketTypeByName(), OpenInterface(), ReadPacket(), StartInterfaceThread(), and WritePacket().
| #define PACKET_TYPE_NONE 0 |
| #define PACKET_TYPE_OBSD_BPF 3 |
Definition at line 16 of file packet.h.
Referenced by GetPacketTypeByName(), OpenInterface(), ReadPacket(), StartInterfaceThread(), and WritePacket().
| #define PACKET_TYPE_OSX_BPF 4 |
Definition at line 17 of file packet.h.
Referenced by GetPacketTypeByName(), OpenInterface(), ReadPacket(), StartInterfaceThread(), and WritePacket().
| #define PACKET_TYPE_PCAP 2 |
| #define PACKET_TYPE_SOLARIS_DLPI 6 |
Definition at line 19 of file packet.h.
Referenced by GetPacketTypeByName(), OpenInterface(), ReadPacket(), StartInterfaceThread(), and WritePacket().
| #define PACKET_TYPE_TCPDUMP 5 |
Definition at line 18 of file packet.h.
Referenced by GetPacketTypeByName(), OpenInterface(), ReadPacket(), StartInterfaceThread(), and WritePacket().
| int AddPacketToPending | ( | int | PacketSlot | ) |
Marks a packet as 'pending' (thread safe, called from ReadPacket) Gets called every time a packet gets put on the pending list. Uses a mutex lock (to avoid problems with threads). This may be called more than once per ReadPacket request.
Definition at line 334 of file packet.c.
References ADD_PACKET_1, global_vars::AllocatedCount, DEBUGPATH, Globals, hlbr_mutex_lock(), hlbr_mutex_unlock(), LastPendingSlot, PACKET_STATUS_PENDING, PacketLockID, PacketMutex, global_vars::Packets, global_vars::PendingCount, packet_rec::Status, and TRUE.
Referenced by ReadPacketTCPDump(), and RebuildPacket().
| int BlockPacket | ( | int | PacketSlot | ) |
Marks a packet as 'blocked' (thread safe). Blocked packets can't be processed until are unblocked. Usually they're blocked by session handling functions
Definition at line 357 of file packet.c.
References Globals, hlbr_mutex_lock(), hlbr_mutex_unlock(), PACKET_STATUS_BLOCKED, PacketLockID, PacketMutex, global_vars::Packets, POP_PACKET_1, packet_rec::Status, and TRUE.
Referenced by AssignSessionTCP().
| int GetEmptyPacket | ( | ) |
Definition at line 412 of file packet.c.
References DEBUG, DEBUGPATH, GET_PACKET_1, Globals, hlbr_mutex_lock(), LastFreeSlot, MAX_PACKETS, NULL, PACKET_STATUS_ALLOCATED, PACKET_STATUS_IDLE, PacketLockID, PacketMutex, global_vars::Packets, packet_rec::PacketSlot, packet_rec::SaveCount, and packet_rec::Status.
Referenced by ReadPacketTCPDump(), RebuildPacket(), and SendARP().
| int GetInterfaceByName | ( | char * | Name | ) |
Definition at line 595 of file packet.c.
References DEBUGPATH, Globals, global_vars::Interfaces, interface_rec::Name, and global_vars::NumInterfaces.
Referenced by RouteBNSAddNode().
| int GetPacketProtoByName | ( | char * | Name | ) |
Definition at line 64 of file packet.c.
References DEBUGPATH, PACKET_PROTO_ETHERNET, and PACKET_PROTO_NONE.
Referenced by ParseInterface().
| int GetPacketRoleByName | ( | char * | Name | ) |
Definition at line 79 of file packet.c.
References DEBUGPATH, PACKET_ROLE_EXTERNAL, PACKET_ROLE_HONEY, PACKET_ROLE_INTERNAL, and PACKET_ROLE_NORMAL.
Referenced by ParseInterface().
| int GetPacketTypeByName | ( | char * | Name | ) |
Definition at line 38 of file packet.c.
References DEBUGPATH, PACKET_TYPE_LINUX_RAW, PACKET_TYPE_NONE, PACKET_TYPE_OBSD_BPF, PACKET_TYPE_OSX_BPF, PACKET_TYPE_PCAP, PACKET_TYPE_SOLARIS_DLPI, and PACKET_TYPE_TCPDUMP.
Referenced by ParseInterface().
| int OpenInterface | ( | int | InterfaceID | ) |
Definition at line 99 of file packet.c.
References DEBUGPATH, FALSE, Globals, global_vars::Interfaces, interface_rec::Name, OpenInterfaceLinuxRaw(), OpenInterfaceOBSDBPF(), OpenInterfaceOSXBPF(), OpenInterfaceSolarisDLPI(), OpenInterfaceTCPDump(), PACKET_TYPE_LINUX_RAW, PACKET_TYPE_OBSD_BPF, PACKET_TYPE_OSX_BPF, PACKET_TYPE_SOLARIS_DLPI, PACKET_TYPE_TCPDUMP, and interface_rec::Type.
Referenced by OpenInterfaces().
| int OpenInterfaces | ( | ) |
Definition at line 140 of file packet.c.
References DEBUGPATH, FALSE, Globals, global_vars::NumInterfaces, OpenInterface(), and TRUE.
Referenced by main().
| int PopFromPending | ( | ) |
Pops a packet off the pending queue Give the caller a packet off the pending queue (marked as PACKET_STATUS_PENDING
Definition at line 384 of file packet.c.
References DEBUGPATH, Globals, hlbr_mutex_lock(), hlbr_mutex_unlock(), MAX_PACKETS, PACKET_NONE, PACKET_STATUS_PENDING, PACKET_STATUS_PROCESSING, PacketLockID, PacketMutex, global_vars::Packets, global_vars::PendingCount, POP_PACKET_1, global_vars::ProcessingCount, and packet_rec::Status.
Referenced by MainLoopPoll(), and ProcessPacketThread().
| int ReadPacket | ( | int | InterfaceID | ) |
Definition at line 156 of file packet.c.
References DEBUGPATH, FALSE, Globals, global_vars::Interfaces, PACKET_TYPE_LINUX_RAW, PACKET_TYPE_OBSD_BPF, PACKET_TYPE_OSX_BPF, PACKET_TYPE_SOLARIS_DLPI, PACKET_TYPE_TCPDUMP, ReadPacketLinuxRaw(), ReadPacketOBSDBPF(), ReadPacketOSXBPF(), ReadPacketSolarisDLPI(), ReadPacketTCPDump(), and interface_rec::Type.
Referenced by MainLoopPoll().
| void ReturnEmptyPacket | ( | int | PacketSlot | ) |
Definition at line 480 of file packet.c.
References global_vars::AllocatedCount, decoder_data::Data, DEBUGPATH, packet_rec::DecoderInfo, FALSE, Globals, hlbr_mutex_lock(), global_vars::IdleCount, packet_rec::LargePacket, NULL, packet_rec::NumDecoderData, PACKET_STATUS_ALLOCATED, PACKET_STATUS_IDLE, PACKET_STATUS_PROCESSING, PacketLockID, PacketMutex, global_vars::Packets, global_vars::ProcessingCount, packet_rec::RawPacket, RETURN_PACKET_1, packet_rec::SaveCount, packet_rec::Status, and packet_rec::TypicalPacket.
Referenced by DecodeIPDefrag(), FreeSaved(), ProcessPacket(), ReadPacketTCPDump(), and SendARP().
| int RuleIsActive | ( | int | PacketSlot, | |
| int | RuleNum | |||
| ) | [inline] |
Definition at line 575 of file packet.c.
References DEBUGPATH, GetBit(), Globals, global_vars::NumRules, global_vars::Packets, and packet_rec::RuleBits.
Referenced by PerformActions(), TestEthernetDst(), TestEthernetSrc(), TestEthernetType(), TestICMPCode(), TestICMPType(), TestIPCheck(), TestIPDst(), TestIPProto(), TestIPSrc(), TestIPTTL(), TestTCPContent(), TestTCPDst(), TestTCPDstOld(), TestTCPFlags(), TestTCPListContent(), TestTCPListNoCase(), TestTCPNoCase(), TestTCPPort(), TestTCPRegExp(), TestTCPSrc(), TestUDPContent(), TestUDPDst(), TestUDPNoCase(), TestUDPRegExp(), and TestUDPSrc().
| int SetRuleInactive | ( | int | PacketSlot, | |
| int | RuleNum | |||
| ) | [inline] |
Definition at line 584 of file packet.c.
References DEBUGPATH, Globals, global_vars::NumRules, global_vars::Packets, packet_rec::RuleBits, SetBit(), and TRUE.
Referenced by TestEthernetDst(), TestEthernetSrc(), TestEthernetType(), TestICMPCode(), TestICMPType(), TestIPCheck(), TestIPProto(), TestTCPDstOld(), TestTCPPort(), TestTCPRegExp(), TestTCPSrc(), TestUDPDst(), and TestUDPRegExp().
| int StartInterfaceThread | ( | int | InterfaceID | ) |
Definition at line 534 of file packet.c.
References DEBUGPATH, FALSE, Globals, global_vars::Interfaces, LoopThreadLinuxRaw(), LoopThreadOBSDBPF(), LoopThreadOSXBPF(), LoopThreadSolarisDLPI(), LoopThreadTCPDump(), PACKET_TYPE_LINUX_RAW, PACKET_TYPE_OBSD_BPF, PACKET_TYPE_OSX_BPF, PACKET_TYPE_SOLARIS_DLPI, PACKET_TYPE_TCPDUMP, TRUE, and interface_rec::Type.
Referenced by MainLoopThreaded().
| int WritePacket | ( | int | PacketSlot | ) |
Definition at line 194 of file packet.c.
References DEBUG, DEBUGPATH, FALSE, Globals, INTERFACE_BROADCAST, global_vars::Interfaces, interface_rec::Name, global_vars::NumInterfaces, PACKET_TYPE_LINUX_RAW, PACKET_TYPE_OBSD_BPF, PACKET_TYPE_OSX_BPF, PACKET_TYPE_SOLARIS_DLPI, PACKET_TYPE_TCPDUMP, packet_rec::PacketLen, global_vars::Packets, packet_rec::RawPacket, packet_rec::TargetInterface, interface_rec::Type, WritePacketLinuxRaw(), WritePacketOBSDBPF(), WritePacketOSXBPF(), WritePacketSolarisDLPI(), and WritePacketTCPDump().
Referenced by RouteAndSend(), and SendARP().
1.5.2