routes/route_bns.c File Reference

#include "route_bns.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "../packets/packet.h"
#include "../engine/num_list.h"
#include "../decoders/decode.h"
#include "../decoders/decode_ethernet.h"
#include "../decoders/decode_arp.h"
#include "../decoders/decode_ip.h"
#include "../decoders/decode_tcp.h"
#include "../decoders/decode_udp.h"
#include <netinet/in.h>
#include <arpa/inet.h>

Go to the source code of this file.

Data Structures

struct  bns_note

Defines

#define BNS_PRODUCTION   1
#define BNS_HONEY   2
#define BNS_INTERNET   3
#define BNS_MAX_NOTES   128

Typedefs

typedef bns_note BNSNote

Functions

int SendARP (unsigned int IP, int Interface)
int FindMac (unsigned char Mac[6])
int AddMac (unsigned char Mac[6], int Interface)
int FindIP (unsigned int IP)
int UpdateIP (unsigned int IP, unsigned char Mac[6], int Interface)
int HandleIPPacket (int PacketSlot, IPData *IData)
int HandleARPPacket (int PacketSlot, ARPData *AData)
int RouteBNS (int PacketSlot)
int RouteBNSAddNode (int RouteID, char *Args)
int InitRouteBNS ()

Variables

BNS_MAC BMAC [MAX_BNS]
int BNSNumMac
BNS_IP BIP [MAX_BNS]
int BNSNumIP
int InternetIF
int ProductionIF
int HoneyIF
int EthernetDecoderID
int ARPDecoderID
int IPDecoderID
int TCPDecoderID
int UDPDecoderID
BNSNote Notes [BNS_MAX_NOTES]
int ThisNote
GlobalVars Globals


Define Documentation

#define BNS_HONEY   2

Definition at line 24 of file route_bns.c.

Referenced by HandleARPPacket(), and UpdateIP().

#define BNS_INTERNET   3

Definition at line 25 of file route_bns.c.

#define BNS_MAX_NOTES   128

Definition at line 51 of file route_bns.c.

Referenced by HandleIPPacket(), and InitRouteBNS().

#define BNS_PRODUCTION   1

Definition at line 23 of file route_bns.c.

Referenced by HandleARPPacket(), and UpdateIP().


Typedef Documentation

typedef struct bns_note BNSNote


Function Documentation

int AddMac ( unsigned char  Mac[6],
int  Interface 
)

Definition at line 169 of file route_bns.c.

References BMAC, BNSNumMac, bns_mac_interface::Interface, bns_mac_interface::Mac, and MAX_BNS.

Referenced by HandleARPPacket(), and HandleIPPacket().

int FindIP ( unsigned int  IP  ) 

Definition at line 213 of file route_bns.c.

References BIP, and BNSNumIP.

Referenced by HandleIPPacket(), and UpdateIP().

int FindMac ( unsigned char  Mac[6]  ) 

Definition at line 146 of file route_bns.c.

References BMAC, and BNSNumMac.

Referenced by HandleARPPacket(), and HandleIPPacket().

int HandleARPPacket ( int  PacketSlot,
ARPData AData 
)

Definition at line 575 of file route_bns.c.

References AddMac(), ARP_OP_REPLY, ARP_OP_REQUEST, BIP, BNS_HONEY, BNS_PRODUCTION, arp_data::EthernetARPHeader, EthernetDecoderID, FindMac(), GetDataByID(), Globals, arp_data::Header, HoneyIF, INTERFACE_BROADCAST, packet_rec::InterfaceNum, InternetIF, arp_header::Operation, global_vars::Packets, packet_rec::PacketSlot, bns_mac_ip::ProdMac, ProductionIF, ROUTE_RESULT_DONE, ROUTE_RESULT_DROP, arp_ether_ip::SenderIP, arp_ether_ip::SenderMac, packet_rec::TargetInterface, and UpdateIP().

Referenced by RouteBNS().

int HandleIPPacket ( int  PacketSlot,
IPData IData 
)

Definition at line 310 of file route_bns.c.

References AddMac(), BIP, BMAC, BNS_MAX_NOTES, BNSRerouteList, ip_header::daddr, DEBUG, EthernetDecoderID, FindIP(), FindMac(), GetDataByID(), Globals, ip_data::Header, bns_note::HIP, HoneyIF, bns_mac_ip::HoneyMac, bns_note::HPort, bns_note::IIP, bns_mac_interface::Interface, packet_rec::InterfaceNum, InternetIF, bns_note::IPort, IsInListTime(), Notes, NULL, global_vars::Packets, packet_rec::PacketSlot, ProductionIF, bns_note::Proto, ip_header::protocol, ROUTE_RESULT_DONE, ROUTE_RESULT_DROP, ip_header::saddr, SendARP(), packet_rec::TargetInterface, TCPDecoderID, ThisNote, packet_rec::tv, and UDPDecoderID.

Referenced by RouteBNS().

int InitRouteBNS (  ) 

Definition at line 875 of file route_bns.c.

References route_rec::AddNode, ARPDecoderID, BIP, BMAC, BNS_MAX_NOTES, BNSNumIP, BNSNumMac, BNSRerouteList, CreateRoute(), DECODER_NONE, EthernetDecoderID, FALSE, GetDecoderByName(), Globals, InitNumList(), IPDecoderID, LIST_TYPE_TIME, MAX_BNS, Notes, ROUTE_NONE, RouteBNS(), RouteBNSAddNode(), route_rec::RouteFunc, global_vars::Routes, TCPDecoderID, ThisNote, TRUE, and UDPDecoderID.

Referenced by InitRoutes().

int RouteBNS ( int  PacketSlot  ) 

Definition at line 728 of file route_bns.c.

References ARPDecoderID, GetDataByID(), Globals, HandleARPPacket(), HandleIPPacket(), HoneyIF, packet_rec::InterfaceNum, InternetIF, IPDecoderID, global_vars::Packets, packet_rec::PacketSlot, ProductionIF, ROUTE_RESULT_CONTINUE, and ROUTE_RESULT_DROP.

Referenced by InitRouteBNS().

int RouteBNSAddNode ( int  RouteID,
char *  Args 
)

Definition at line 767 of file route_bns.c.

References AddIPRanges(), BNSRerouteList, FALSE, GetInterfaceByName(), Globals, HoneyIF, INTERFACE_NONE, global_vars::Interfaces, InternetIF, interface_rec::Name, ProductionIF, and TRUE.

Referenced by InitRouteBNS().

int SendARP ( unsigned int  IP,
int  Interface 
)

Definition at line 65 of file route_bns.c.

References ARP_OP_REQUEST, ARP_TYPE_ETHERNET, ARP_TYPE_IP, ethernet_header::DstMac, ETHERNET_TYPE_ARP, FALSE, GetEmptyPacket(), Globals, arp_header::HardwareLen, arp_header::HardwareType, arp_header::Operation, PACKET_NONE, packet_rec::PacketLen, global_vars::Packets, arp_header::ProtocolLen, arp_header::ProtocolType, packet_rec::RawPacket, ReturnEmptyPacket(), arp_ether_ip::SenderIP, arp_ether_ip::SenderMac, ethernet_header::SrcMac, packet_rec::TargetInterface, arp_ether_ip::TargetIP, arp_ether_ip::TargetMac, ethernet_header::Type, packet_rec::TypicalPacket, and WritePacket().

Referenced by HandleIPPacket().

int UpdateIP ( unsigned int  IP,
unsigned char  Mac[6],
int  Interface 
)

Definition at line 230 of file route_bns.c.

References BIP, BNS_HONEY, BNS_PRODUCTION, BNSNumIP, FALSE, FindIP(), bns_mac_ip::HasHoney, bns_mac_ip::HasProd, bns_mac_ip::HoneyMac, bns_mac_ip::IP, MAX_BNS, bns_mac_ip::ProdMac, and TRUE.

Referenced by HandleARPPacket().


Variable Documentation

int ARPDecoderID

Definition at line 37 of file route_bns.c.

BNS_IP BIP[MAX_BNS]

Definition at line 29 of file route_bns.c.

Referenced by FindIP(), HandleARPPacket(), HandleIPPacket(), InitRouteBNS(), and UpdateIP().

BNS_MAC BMAC[MAX_BNS]

Definition at line 27 of file route_bns.c.

Referenced by AddMac(), FindMac(), HandleIPPacket(), and InitRouteBNS().

int BNSNumIP

Definition at line 30 of file route_bns.c.

Referenced by FindIP(), InitRouteBNS(), and UpdateIP().

int BNSNumMac

Definition at line 28 of file route_bns.c.

Referenced by AddMac(), FindMac(), and InitRouteBNS().

int EthernetDecoderID

Definition at line 36 of file route_bns.c.

GlobalVars Globals

Definition at line 41 of file hlbr.c.

int HoneyIF

Definition at line 34 of file route_bns.c.

Referenced by HandleARPPacket(), HandleIPPacket(), RouteBNS(), and RouteBNSAddNode().

int InternetIF

Definition at line 32 of file route_bns.c.

Referenced by HandleARPPacket(), HandleIPPacket(), RouteBNS(), and RouteBNSAddNode().

int IPDecoderID

Definition at line 38 of file route_bns.c.

BNSNote Notes[BNS_MAX_NOTES]

Definition at line 53 of file route_bns.c.

Referenced by HandleIPPacket(), and InitRouteBNS().

int ProductionIF

Definition at line 33 of file route_bns.c.

Referenced by HandleARPPacket(), HandleIPPacket(), RouteBNS(), and RouteBNSAddNode().

int TCPDecoderID

Definition at line 39 of file route_bns.c.

int ThisNote

Definition at line 54 of file route_bns.c.

Referenced by HandleIPPacket(), and InitRouteBNS().

int UDPDecoderID

Definition at line 40 of file route_bns.c.


Generated on Sat Jul 7 23:33:11 2007 for HLBR by  doxygen 1.5.2