#include <ace/ACE.h> class ACE {
public:
static ssize_t recv ( ACE_HANDLE handle, void *buf, size_t len, int flags );
static ssize_t recv (ACE_HANDLE handle, void *buf, size_t len);
static ssize_t send ( ACE_HANDLE handle, const void *buf, size_t len, int flags );
static ssize_t send ( ACE_HANDLE handle, const void *buf, size_t len );
static ssize_t recv_n ( ACE_HANDLE handle, void *buf, size_t len, int flags );
static ssize_t recv_n (ACE_HANDLE handle, void *buf, size_t len);
static ssize_t send_n ( ACE_HANDLE handle, const void *buf, size_t len, int flags );
static ssize_t send_n ( ACE_HANDLE handle, const void *buf, size_t len );
static ssize_t read_n (ACE_HANDLE handle, void *buf, size_t len);
static ssize_t write_n ( ACE_HANDLE handle, const void *buf, size_t len );
static int bind_port (ACE_HANDLE handle);
static int handle_timed_accept ( ACE_HANDLE listener, ACE_Time_Value *timeout, int restart );
static ACE_HANDLE handle_timed_complete ( ACE_HANDLE listener, ACE_Time_Value *timeout );
static ACE_HANDLE handle_timed_open ( ACE_Time_Value *timeout, LPCTSTR name, int flags, int perms );
static int set_flags (ACE_HANDLE handle, int flags);
static int clr_flags (ACE_HANDLE handle, int flags);
static int set_handle_limit (int new_limit = -1);
static size_t round_to_pagesize (off_t length);
static int format_hexdump ( char *buffer, int size, char *obuf, int obuf_sz );
static char *strenvdup (const char *str);
static char *strecpy (char *s, const char *t);
static const char *execname (const char *pathname);
static const char *basename (const char *pathname, char delim);
static char *timestamp (char date_and_time[], int time_len);
static int daemonize (void);
static int ldfind ( const char *filename, char *pathname, size_t maxlen );
static FILE *ldopen (const char *filename, const char *type);
static u_long hash_pjw (const char *str);
static int map_errno (int error);
static void *read_adapter (void *event_handler);
static int register_stdin_handler ( ACE_Event_Handler *eh, ACE_Reactor *reactor, ACE_Thread_Manager *thr_mgr, int flags = THR_DETACHED );
private:
ACE (void);
};
static ssize_t recv (
ACE_HANDLE handle,
void *buf,
size_t len,
int flags
);
len
bytes into buf
from handle
(uses the
recv
call).
static ssize_t recv (ACE_HANDLE handle, void *buf, size_t len);
len
bytes into buf
from handle
(uses the
read
system call on UNIX and the recv
call on Win32).
static ssize_t send (
ACE_HANDLE handle,
const void *buf,
size_t len,
int flags
);
len
bytes into buf
from handle
(uses the send
call).
static ssize_t send (ACE_HANDLE handle, const void *buf, size_t len);
len
bytes into buf
from handle
(uses the write
system call on UNIX and the send
call on Win32).
static ssize_t recv_n (
ACE_HANDLE handle,
void *buf,
size_t len,
int flags
);
len
bytes into buf
from handle
(uses the recv
call).
static ssize_t recv_n (ACE_HANDLE handle, void *buf, size_t len);
len
bytes into buf
from handle
(uses the read
system call on UNIX and the recv
call on Win32).
static ssize_t send_n (
ACE_HANDLE handle,
const void *buf,
size_t len,
int flags
);
len
bytes into buf
from handle
(uses the send
system call).
static ssize_t send_n (
ACE_HANDLE handle,
const void *buf,
size_t len
);
len
bytes into buf
from handle
(uses the write
system call on UNIX and the recv
call on Win32).
static ssize_t read_n (ACE_HANDLE handle, void *buf, size_t len);
len
bytes into buf
from handle
(uses the read
system call on UNIX and the ReadFile
call on Win32).
static ssize_t write_n (
ACE_HANDLE handle,
const void *buf,
size_t len
);
len
bytes into buf
from handle
(uses the write
system call on UNIX and the WriteFile
call on Win32).
static int bind_port (ACE_HANDLE handle);
handle
.
static int handle_timed_accept (
ACE_HANDLE listener,
ACE_Time_Value *timeout,
int restart
);
timeout
amount of time to passively establish a
connection. This method doesn't perform the accept
, it just
does the timed wait...
static ACE_HANDLE handle_timed_complete (
ACE_HANDLE listener,
ACE_Time_Value *timeout
);
timeout
amount of time to complete an actively
established non-blocking connection.
static ACE_HANDLE handle_timed_open (
ACE_Time_Value *timeout,
LPCTSTR name,
int flags,
int perms
);
timeout
amount of time to actively open a device.
This method doesn't perform the connect
, it just does the timed
wait...
static int set_flags (ACE_HANDLE handle, int flags);
handle
.
static int clr_flags (ACE_HANDLE handle, int flags);
handle
.
static int set_handle_limit (int new_limit = -1);
static size_t round_to_pagesize (off_t length);
static int format_hexdump (
char *buffer,
int size,
char *obuf,
int obuf_sz
);
static char *strenvdup (const char *str);
str
, substituting
the environment variable if str[0] == '$'
. Note that the
pointer is allocated with ACE_OS::malloc
and must be freed by
ACE_OS::free
static char *strecpy (char *s, const char *t);
t
to s
, returning a pointer to the end of the copied
region (rather than the beginning, a la strcpy
.
static const char *execname (const char *pathname);
pathname
if it already ends in ".exe,"
otherwise returns a dynamically allocated buffer containing
"pathname
.exe". Always returns pathname
on UNIX.
static const char *basename (const char *pathname, char delim);
pathname
.
static char *timestamp (char date_and_time[], int time_len);
day_and_time
.
static int daemonize (void);
static int ldfind (
const char *filename,
char *pathname,
size_t maxlen
);
filename
either using absolute path or using
ACE_LD_SEARCH_PATH (e.g., $LD_LIBRARY_PATH on UNIX or $PATH on
Win32).
static FILE *ldopen (const char *filename, const char *type);
ldopen
to locate and open the appropriate filename
and
returns a pointer to the file, else it returns a NULL
pointer. type
specifies how the file should be open.
static u_long hash_pjw (const char *str);
str
using the ``Hash PJW'' routine...
static int map_errno (int error);
static void *read_adapter (void *event_handler);
event_handler
must be a
subclass of ACE_Event_Handler
. If the get_handle
method of
this event handler returns ACE_INVALID_HANDLE
we default to
reading from ACE_STDIN.
static int register_stdin_handler (
ACE_Event_Handler *eh,
ACE_Reactor *reactor,
ACE_Thread_Manager *thr_mgr,
int flags = THR_DETACHED
);