util.h File Reference

#include <vector>

Go to the source code of this file.

Typedefs

typedef std::pair< uint32_t,
uint16_t > 
AddressPortPair

Functions

int GetFileSize (const std::string &sFile)
std::string GetDotFormatIP (uint32_t ip)
void reuse (int fd)
void nonblock (int fd)
void nodelay (int fd)
void ByteOrderTesting ()
int RunAsDaemon (const char *stdoutname)
int write_pid (const char *sFileName)
AddressPortPair GetSockName (uint32_t sock)
int StringTokenizer (const std::string sToParse, const char *cToken, std::vector< std::string > &v)


Detailed Description

Utility functions.

Function Documentation

std::string GetDotFormatIP ( uint32_t  ip  ) 

Returns the dot formatted IP address from 4 byte ip.

int GetFileSize ( const std::string &  sFile  ) 

Returns the size of the sFile in bytes.

AddressPortPair GetSockName ( uint32_t  sock  ) 

Retrieves IP and port of s socket sock.

void nodelay ( int  fd  ) 

Disables naggles algorithm.

void nonblock ( int  fd  ) 

Makes socket fd non-blocking.

void reuse ( int  fd  ) 

Makes socket fd reuseable.

int RunAsDaemon ( const char *  stdoutname  ) 

Runs current process as daemon. write all output to stdoutname file.

int StringTokenizer ( const std::string  sToParse,
const char *  cToken,
std::vector< std::string > &  v 
)

A special string tokenizer. Used for finding gossip message ID from a list.

int write_pid ( const char *  sFileName  ) 

Creates a pid file with the pid number of the daemon.


Generated on Thu Sep 16 11:51:44 2010 for Communication Component by  doxygen 1.4.7