Main Page   Class Hierarchy   Compound List   File List   Compound Members   Examples  

usipp::IP Class Reference

#include <ip.h>

Inheritance diagram for usipp::IP:

usipp::Layer2 usipp::ICMP usipp::TCP usipp::UDP List of all members.

Public Methods

 IP (const char*, u_int8_t)
 IP (u_int32_t, u_int8_t)
virtual ~IP ()
u_int8_t get_hlen ()
u_int8_t get_vers ()
u_int8_t get_tos ()
u_int16_t get_totlen ()
u_int16_t get_id ()
u_int16_t get_fragoff ()
u_int16_t get_fflags ()
u_int8_t get_ttl ()
u_int8_t get_proto ()
u_int16_t get_sum ()
u_int32_t get_src ()
u_int32_t get_dst ()
IP& operator= (const IP&)
 IP (const IP&)
char* get_src (int resolv, char *buf, size_t buflen)
char* get_dst (int resolv, char *buf, size_t buflen)
int set_hlen (u_int8_t)
int set_vers (u_int8_t)
int set_tos (u_int8_t)
int set_totlen (u_int16_t)
int set_id (u_int16_t)
int set_fragoff (u_int16_t)
int set_fflags (u_int16_t)
int set_ttl (u_int8_t)
int set_proto (u_int8_t)
int set_sum (u_int16_t)
int set_src (u_int32_t)
int set_dst (u_int32_t)
int set_src (const char *ip_or_name)
int set_dst (const char*)
iphdr get_iphdr ()
virtual int sendpack (void *payload, size_t paylen)
virtual int sendpack (char *pay_string)
virtual int sniffpack (void *buf, size_t len)
virtual int init_device (char *, int, size_t)

Protected Methods

char* reassemble (char *, int, int *)

Protected Attributes

struct iphdr iph
char ipOptions [40]
struct sockaddr_in saddr
char host [1000]

Detailed Description

All about IP


Constructor & Destructor Documentation

usipp::IP::IP ( const char *,
u_int8_t )
 

Expects destination-adress and protocol

usipp::IP::IP ( u_int32_t,
u_int8_t )
 

Destination-adress in network-order

usipp::IP::~IP ( ) [virtual]
 

Destructor

usipp::IP::IP ( const IP & )
 

Copy-construktor


Member Function Documentation

char * usipp::IP::get_dst ( int resolv,
char * buf,
size_t buflen )
 

Ditto, destination-adress.

u_int32_t usipp::IP::get_dst ( )
 

Ditto, destination-adress.

u_int16_t usipp::IP::get_fragoff ( )
 

Get fragmentation offset.

u_int8_t usipp::IP::get_hlen ( )
 

Returns headerlen/4.

u_int16_t usipp::IP::get_id ( )
 

Get id-field.

iphdr usipp::IP::get_iphdr ( )
 

Return complete IP header. usefull for special ICMP packets

u_int8_t usipp::IP::get_proto ( )
 

Get protocol, TCP or such.

char * usipp::IP::get_src ( int resolv,
char * buf,
size_t buflen )
 

Get source-adress i human-readable-form. Resolve to an hostname, if resolv==1.

u_int32_t usipp::IP::get_src ( )
 

Get source-adress of packet, in network order.

u_int16_t usipp::IP::get_sum ( )
 

Get IP-header checksum

u_int8_t usipp::IP::get_tos ( )
 

Get Type Of Service.

u_int16_t usipp::IP::get_totlen ( )
 

Get total length of packet, including any data. Return len in host-order.

u_int8_t usipp::IP::get_vers ( )
 

returns IP-version. Should give 4 always.

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

Initialize a device for packet capturing

Reimplemented from usipp::Layer2.

Reimplemented in usipp::ICMP, usipp::TCP, and usipp::UDP.

IP & usipp::IP::operator= ( const IP & )
 

assig-operator

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

Send a Packet.

Reimplemented in usipp::ICMP, usipp::TCP, and usipp::UDP.

int usipp::IP::set_dst ( const char * )
 

Ditto, destination. Not needed if the destination given in the constructor is OK.

int usipp::IP::set_dst ( u_int32_t )
 

Ditto, destination.

int usipp::IP::set_hlen ( u_int8_t )
 

Set header-len in number of 32 bit words. 5 (5*4 = 20) in normal case. Contructor does this for you, so you should not use this.

int usipp::IP::set_id ( u_int16_t )
 

Set ID-field. Also not needed.

int usipp::IP::set_proto ( u_int8_t )
 

Set protocol. If you use TCP {} or such, you don't need to do it yourself.

int usipp::IP::set_src ( const char * ip_or_name )
 

Set source-adress.

int usipp::IP::set_src ( u_int32_t )
 

Set source-adress. Expects Network-ordered.

int usipp::IP::set_totlen ( u_int16_t )
 

Set total length of packet. Not needed.

int usipp::IP::set_ttl ( u_int8_t )
 

Set time-to-live field. Not needed.

int usipp::IP::set_vers ( u_int8_t )
 

Set version-field. Normally not needed.

int usipp::IP::sniffpack ( void * buf,
size_t buflen ) [virtual]
 

Capture an packet from the net

Reimplemented from usipp::Layer2.

Reimplemented in usipp::ICMP, usipp::TCP, and usipp::UDP.


The documentation for this class was generated from the following file:
Generated at Fri May 11 13:02:56 2001 for libusi++ by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000