32 lines
989 B
C
32 lines
989 B
C
#include "arp_connblock.h"
|
|
|
|
#include <stddef.h>
|
|
|
|
#include "../packet_parsers/packet_parsers.h"
|
|
#include "../../utils.h"
|
|
#include "../../dynmem.h"
|
|
#include "../packet_parsers/arp_packet.h"
|
|
|
|
static bool filtArp(const PcktSieveFilterCondition * filtCond, const PcktProps * contProps, const PcktProps * ownProps) {
|
|
EthernetProps * ethProps = (EthernetProps *) contProps;
|
|
ArpProps * arpProps = (ArpProps *) ownProps;
|
|
|
|
return ethProps->length_type == ETH_ARP_PACKET_CLASS;
|
|
}
|
|
|
|
ConnBlock arp_new_connblock(EthInterface * intf) {
|
|
ConnBlock arpConnB; // create ARP connblock
|
|
|
|
PcktSieveFilterCondition filtCond;
|
|
packfiltcond_zero(&filtCond);
|
|
PcktSieveLayerTag tag;
|
|
tag.u = 0;
|
|
arpConnB.sieveLayer = packsieve_new_layer(&intf->sieve.layer0, &filtCond, false, filtArp, NULL, tag, ETH_ARP_PACKET_CLASS);
|
|
ASSERT_NULL(arpConnB.sieveLayer);
|
|
|
|
arpConnB.intf = intf;
|
|
|
|
SNPRINTF(arpConnB.sieveLayer->infoTag, PCKT_SIEVE_INFOTAG_LEN, "ARP");
|
|
|
|
return arpConnB;
|
|
} |