Classes | Defines | Functions | Variables

string_socket.cpp File Reference

#include <string.h>
#include <pthread.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include "string_socket.h"
#include "../common/util_classes.h"
#include <errno.h>
Include dependency graph for string_socket.cpp:

Classes

Defines

Functions

Variables


Define Documentation

#define SOCKET   int

Referenced by create_socket(), and CHost::RunThread().


Function Documentation

bool CloseSocket ( int  l_socket  ) 
bool send_buffer ( int  client_fd,
const char *  Buffer,
int  Length,
string &  Error 
) [inline]

References Format().

Referenced by SendString().

Here is the call graph for this function:

Here is the caller graph for this function:

bool SendString ( int  client_fd,
const char *  Str,
uint32_t  PacketLength,
string &  ErrorStr 
)

References send_buffer().

Referenced by CHost::AnswerByRequest(), CDDCServerListenHost::GetFirstHitsFromCorpora(), CDDCServerListenHost::GetHitStringsFromOneCorpora(), and SaveTrigger().

Here is the call graph for this function:

Here is the caller graph for this function:

NetworkErrorsEnum recieve_buffer ( int  client_fd,
char *  Buffer,
int  Length,
int &  have_read,
int  TimeOut 
) [inline]

Referenced by RecieveString().

Here is the caller graph for this function:

NetworkErrorsEnum RecieveString ( int  client_fd,
string &  Result,
int  TimeOut 
)

References neSuccess, and recieve_buffer().

Referenced by CHost::AnswerByRequest(), CDDCServerListenHost::GetFirstHitsFromCorpora(), and CDDCServerListenHost::GetHitStringsFromOneCorpora().

Here is the call graph for this function:

Here is the caller graph for this function:

bool SetSocketRecieveBuffer ( int  socket_fd,
int  BufferSize 
)

Referenced by CHost::RunThread().

Here is the caller graph for this function:

bool SetSocketSendBuffer ( int  socket_fd,
int  BufferSize 
)
string GetBindErrorLinux ( int  ErrCode  ) 

References ERROR_STRUCT::errstr, and Format().

Referenced by create_socket().

Here is the call graph for this function:

Here is the caller graph for this function:

int create_socket ( const char *  HostName,
int  Port,
bool  bBind,
string &  strError 
)

References CloseSocket(), Format(), GetBindErrorLinux(), and SOCKET.

Referenced by CHost::CreateAndConnectSocket(), and CHost::RunThread().

Here is the call graph for this function:

Here is the caller graph for this function:

bool SocketInitialize ( bool  bReadFromLocalFile  ) 

Referenced by ListenerThread(), and main().

Here is the caller graph for this function:

bool SocketDeinitialize (  ) 

Referenced by ListenerThread(), main(), and UnloadData().

Here is the caller graph for this function:

string GetNetworkErrorString ( const NetworkErrorsEnum t  ) 
bool LoadHosts ( string  Path,
vector< CHost > &  Hosts 
)

References FileExists(), pdMediumDensity, CHost::ReadFromString(), and Trim().

Referenced by LoadDDCServer(), and LoadLocalCorpora().

Here is the call graph for this function:

Here is the caller graph for this function:

void* ListenerThread ( void *  pParam  ) 

References CHost::m_LogFunction, CHost::RunThread(), SocketDeinitialize(), and SocketInitialize().

Referenced by CHost::CreateListener().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char msg_no_error[19] = "No error occurred!"
const char msg_unknown_error[14] = "Unknown error"
const string DDCCloseSocketString = "ddc_close_socket"

Referenced by CHost::AnswerByRequest().

Initial value:
 {     
        {EINTR,           "Socket Error! EINTR - Interrupted"},     
        {EBADF, "Socket Error! EBADF - Bad file number"},                
        {EFAULT,   "Socket Error! EFAULT - Bad address"},               
        {EINVAL,          "Socket Error! EINVAL - Invalid argument"},               
        {EMFILE,          "Socket Error! EMFILE - Too many open files"},            
        {EACCES,  "Socket Error! The address is protected, and the user is not the super-user."} ,
        {EROFS , "Socket Error! The socket inode would reside on a read-only file system."},
        {EFAULT, "Socket Error! my_addr points outside the user's accessible address space. "},
        {ENAMETOOLONG, "Socket Error! my_addr is too long."}, 
        {ENOENT, "Socket Error! The file does not exist."},
        {ENOMEM, "Socket Error! Insufficient kernel memory was available." },
        {ENOTDIR, "Socket Error! A component of the path prefix is not a directory." },


        {ELOOP, "Too many symbolic links were encountered in resolving my_addr" },
        {ENOTSOCK, "Argument is a descriptor for a file, not a socket."}


}
const int FLAGS = 0