Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

nethelp.c File Reference

provides helpful basic network functions More...

#include <pcap.h>
#include <string.h>
#include "nethelp.h"
#include "berkeleyapi.h"
#include "debug.h"

Go to the source code of this file.

Functions

errorcode resolveIP (char *ip_or_name, ip_t *ip)
 resolves a hostname or IP to a 32bit IP number
errorcode bindSocket (port_t port_to_bind, sock_t *sd)
 binds a socket
errorcode tcp_connect (ip_t ip, port_t port, sock_t *sd)
 creates a TCP connection


Detailed Description

provides helpful basic network functions

Author:
Daniel Ferullo (ferullo@cmu.edu)

Definition in file nethelp.c.


Function Documentation

errorcode bindSocket port_t  port_to_bind,
sock_t sd
 

binds a socket

Parameters:
port_to_bind the desired port
sd a pointer to an int to fill in with the socket descriptor for the bound socket, if successful. On error the value is undefined.
Returns:
SUCCESS, errorcode on failure

Definition at line 55 of file nethelp.c.

References CHECK_NOT_NULL, DBG_NETWORK, DBG_PORT, DEBUG, ERROR_NULL_ARG_2, and errorcode.

Referenced by capture_flooded_synack(), natblaster_connect(), and natblaster_server().

errorcode resolveIP char *  ip_or_name,
ip_t ip
 

resolves a hostname or IP to a 32bit IP number

Parameters:
ip_or_name the hostname or IP as a string
ip the IP as a 32bit number

Definition at line 30 of file nethelp.c.

References CHECK_NOT_NULL, ERROR_NULL_ARG_1, ERROR_NULL_ARG_2, and errorcode.

Referenced by main().

errorcode tcp_connect ip_t  ip,
port_t  port,
sock_t sd
 

creates a TCP connection

Parameters:
ip the network byte order 32 bit ip address to connect to
port the port to connect to
sd a pointer to a sd to fill in with the connection sd (value undefined on error) If the socket descriptor is greater than zero then the current socket descriptor will be used, otherwise a new one will be created.
Returns:
SUCCESS, errorcode on failure

Definition at line 88 of file nethelp.c.

References CHECK_NOT_NULL, DBG_ALL, DEBUG, ERROR_NULL_ARG_3, and errorcode.

Referenced by peer_fsm_conn_again(), and peer_fsm_start().


Generated on Wed Mar 30 23:20:48 2005 for NATBLASTER by  doxygen 1.3.9.1