/**************************************/
/* DESCRIPTION */

// Useful network tools used by many functions.


/*******************************************/
/* INCLUDES */

#ifndef __TOOL_H__
#define __TOOL_H__
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <dnet.h>
#include <unistd.h>
#include "util.h"


/*******************************************/
/* DEFINES AND ENUM */

#define UDP_CONNECTION		1
#define TCP_CONNECTION		2


/*******************************************/
/* PROTOTYPES */

int establish_ip_connection(sockaddr_in * addr_ptr, int port,
			    int *data_sock_ptr, int type);
int open_ip_sock(int type, int *the_sock);
int bind_ip_sock(int *sock_ptr, int port);
int get_port(char *arg, int *port);
int get_ip_address(char *addr_str, sockaddr_in * addr_ptr);
int shutdown_read_on_socket(int *sock_ptr);
void put_int(unsigned long the_int, unsigned char *buffer);
unsigned long get_int(unsigned char *buffer);


#endif
