ARB
Functions
arb_cs.cxx File Reference
#include "arb_cs.h"
#include "arb_msg.h"
#include "arb_pattern.h"
#include "arb_string.h"
#include <smartptr.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/stat.h>
#include <netinet/tcp.h>
Include dependency graph for arb_cs.cxx:

Go to the source code of this file.

Functions

static void arb_gethostbyname (const char *name, struct hostent *&he, GB_ERROR &err)
 
const chararb_gethostname ()
 
size_t arb_socket_read (int socket, char *ptr, size_t size)
 
ssize_t arb_socket_write (int socket, const char *ptr, size_t size)
 
static GB_ERROR arb_open_unix_socket (char *name, bool do_connect, int *fd)
 
static GB_ERROR arb_open_tcp_socket (char *name, bool do_connect, int *fd)
 
GB_ERROR arb_open_socket (const char *name, bool do_connect, int *fd, char **filename_out)
 

Function Documentation

static void arb_gethostbyname ( const char name,
struct hostent *&  he,
GB_ERROR err 
)
static

Definition at line 37 of file arb_cs.cxx.

References GBS_global_string(), and NULp.

Referenced by arb_open_tcp_socket().

const char* arb_gethostname ( )

Definition at line 51 of file arb_cs.cxx.

References ARB_strdup(), buffer, and gethostname().

Referenced by arb_open_tcp_socket(), and GB_host_is_local().

size_t arb_socket_read ( int  socket,
char ptr,
size_t  size 
)
ssize_t arb_socket_write ( int  socket,
const char ptr,
size_t  size 
)
static GB_ERROR arb_open_unix_socket ( char name,
bool  do_connect,
int fd 
)
static

Definition at line 161 of file arb_cs.cxx.

References error(), GBS_global_string(), and NULp.

Referenced by arb_open_socket().

static GB_ERROR arb_open_tcp_socket ( char name,
bool  do_connect,
int fd 
)
static

Definition at line 232 of file arb_cs.cxx.

References arb_gethostbyname(), arb_gethostname(), error(), GBS_global_string(), and NULp.

Referenced by arb_open_socket().

GB_ERROR arb_open_socket ( const char name,
bool  do_connect,
int fd,
char **  filename_out 
)

Opens and prepares a socket

If

Parameters
namebegins with ":", the remainder is shell expanded and a unix socket is created. If
containsno ":" it must be numeric, giving the TCPport number to open. If
containsa ":" in the middle, the first part is considered the hostname and the latter part the port.
namename of port {[<host>:]<port>|:<filename>}
do_connectconnect if true (client), otherwise bind (server)
*fdfile descriptor of opened socket (out) or 0 (never returns <0!)
filename_outfilename of unix socket (out) must be NULp or allocated (will be freed)
Returns
NULp if all went fine -> *fd>0 "" if could not connect -> *fd==0 otherwise error message -> *fd==0

Definition at line 124 of file arb_cs.cxx.

References arb_assert, arb_open_tcp_socket(), arb_open_unix_socket(), arb_shell_expand(), ARB_strdup(), error(), GB_incur_error(), and NULp.

Referenced by aisc_open(), gbcm_open_socket(), and open_aisc_server().