Namespaces   Class Hierarchy   Compound List   File List   Header Files   Compound Members   File Members   Examples  

IP Class Reference

The IP-class. More...

#include <usi++.h>

Class diagram for IP:

Datalink UDP TCP ICMP

List of all members.

Public Members

Friends


Detailed Description

The IP-class.


Member Function Documentation

IP::IP (const char * dst, u_int8_t proto)

Create a IP-packet, with 'dst' for destination-adress. Set the protocol-filed in the IP-header to 'proto'. This is used by the derived classes (TCP etc.) to set the correct protocol (IPPROTO_TCP etc.)

IP::IP (u_int32_t dst, u_int8_t proto)

Same as above, but use networkbyte-ordered int32 for destination-adress. This is usefull in case you do sth. like ip.set_src(ip2.get_src())

u_int16_t IP::get_id ()

Get the IP id field.

u_int8_t IP::get_ttl ()

Get time to live.

Examples:
icmp_sniff.cc.

u_int8_t IP::get_proto ()

Obtain the actuall protocol.

u_int32_t IP::get_src ()

Return the source-adress of actuall IP-packet in network-byte order.

Examples:
blindSpoof.cc, icmp_sniff.cc and tcp_sniff.cc.

u_int32_t IP::get_dst ()

Get the destination-adress in networkbyteorder.

Examples:
blindSpoof.cc, icmp_sniff.cc and tcp_sniff.cc.

char * IP::get_src (int resolv, char * s, int len)

Get the sourceadress in human-readable form. If 'resolv' == 1, return hostname, if 0 only IP-adress.

char * IP::get_dst (int resolv, char * s, int len)

Get the destination-adress in human-readable form. If resolv == 1, then resolve to a hostname if possible, otherwise give back IP (resolv == 0).

int IP::set_id (u_int16_t id)

Set the IP id field.

int IP::set_ttl (u_int8_t ttl)

Set time to live

int IP::set_proto (u_int8_t p)

Change the protocol-filed of IP header to 'p' in case you need to.

int IP::set_src (u_int32_t s)

Set the source-adress, use networkbyteorderes adress.

int IP::set_dst (u_int32_t d)

Set destination adress.

int IP::set_src (const char * host)

Set the sourceadress, use hostname or IP.

Examples:
blindSpoof.cc, tcp_sniff.cc and udp_spoof.cc.

int IP::set_dst (const char * host)

Set destinationadress, similar to set_src()

Examples:
tcp_sniff.cc.

int IP::sendpack (void * payload, int paylen) [virtual]

Send a packet, containing 'paylen' bytes of data.

Reimplemented in UDP, TCP and ICMP.

int IP::recvpack (void * buf, int len) [virtual]

Handle packets that are dedicated to one of our local adresses.

Reimplemented in UDP, TCP and ICMP.

int IP::sniffpack (void * buf, int len) [virtual]

Handle packets, that are NOT actually for the local adress!

Reimplemented in UDP, TCP and ICMP.

int IP::init_device (char * dev, int promisc, int snaplen) [virtual]

Initialize a device ("eth0" for example) for packet- capturing. It MUST be called before sniffpack() is launched. Set 'promisc' to 1 if you want the device running in promiscous mode. Fetch at most 'snaplen' bytes per call.

Reimplemented from Datalink.

Reimplemented in UDP, TCP and ICMP.


The documentation for this class was generated from the following file:
Generated at Sun Oct 10 13:51:36 1999 for libusi++ by doxygen  written by Dimitri van Heesch, © 1997-1999