Galaxy Communicator Documentation:

Utilities Library

License / Documentation home / Help and feedback


 

This documentation briefly describes functions in the directory src/libGalaxy/util and elsewhere which are present but probably will not be used by the developer. The signatures of these functions may change from release to release.



Sockets

int GalUtil_IPFromHostname(char *hostname)
Produces an IPv4 address from hostname.

int GalUtil_IP4Address(unsigned long *inaddr)
Tries to find a non-loopback IP address (not on Win32).

GAL_SOCKET GalUtil_SockCreateServer(unsigned short port, int n_listen)
Creates a server on port with a queue of length n_listen.

GAL_SOCKET GalUtil_SockCreateClient(char *host, unsigned short port)
Creates a client connection to host at port.

GAL_SOCKET GalUtil_SockServerAcceptConnection(GAL_SOCKET sock, char *host)
 

int GalUtil_SockServerCheckForConnection(GAL_SOCKET sock, char *host, int *client_sock)

int GalUtil_SockServerBlockingCheckForConnection(GAL_SOCKET sock, char *host, int *client_sock)

void GalUtil_SockServerInaddrToString(unsigned long inaddr, char *s)

int GalUtil_SockServerHostnameToInaddr(char *hostname, unsigned long *inaddr)

int GalUtil_SockClose(GAL_SOCKET sock)

int GalUtil_SockBlockOn(GAL_SOCKET sock)

int GalUtil_SockBlockOff(GAL_SOCKET sock)

int GalUtil_SockCanWrite(GAL_SOCKET sock)

int GalUtil_SockCanRead(GAL_SOCKET sock)

long GalUtil_SockBytesWaiting(GAL_SOCKET sock)

int GalUtil_SockSelect(int maxfd, fd_set *read_fdset, fd_set *write_fdset, fd_set *err_fdset, struct timeval *tp, int *interrupted)
Cross-platform select() call. If select() returned because the system call was interrupted by a signal, the integer interrupted points to is set to 1 (if interrupted is not NULL).


Command line argument parsing

void GalUtil_OAPrintOptions(int argc, char **argv, char **oas, char *tag)

int GalUtil_OASplitArgs(int argc, char **argv, char **oas, int *first_real_arg, int *in_argc, char ***in_argv, int *ex_argc, char ***ex_argv)

int GalUtil_OAUiCheckUsage(const char *progname, int argc, char **argv, char **oas, int *first_real_arg)

void GalUtil_OAUiPrintUsage(const char *progname, int argc, char **argv, char **oas)

int GalUtil_OAUiExtract(int argc, char **argv, char **oas, const char *key, ... )

void GalUtil_OAUiExtractAsserting(int argc, char **argv, char **oas, const char *key, ... )

intGalUtil_SAExtract(int argc, char **argv, const char *key, int num, ... )

void _GalUtil_FreeOASDescription(GalUtil_OASDescription *descr)

GalUtil_OASDescription *GalUtil_OADigest(char **oas)

int GalUtil_RemoveOASArg(GalUtil_OASDescription *descr, const char *key)


Threads

These functions and macros are intended to provide a common interface to Posix and Win32 threads. See the thread notes.

GalUtil_LocalMutex*GalUtil_CreateLocalMutex(void )

void GalUtil_DestroyLocalMutex(GalUtil_LocalMutex *mutex)

void GalUtil_InitLocalMutex(GalUtil_LocalMutex *mutex)

void GalUtil_LockLocalMutex(GalUtil_LocalMutex *mutex)

void GalUtil_UnlockLocalMutex(GalUtil_LocalMutex *mutex)

GalUtil_ThreadID GalUtil_CurrentThreadID()

int GalUtil_EqualThreadID(GalUtil_ThreadID x, GalUtil_ThreadID y)

void GalUtil_ThreadPushCleanup(void (*handler)(void*), void *arg)

int GalUtil_ThreadPopCleanup(int execute)

intGalUtil_ThreadCancel(GalUtil_ThreadID tid)

void GalUtil_ThreadTestCancel()

void GalUtil_ThreadCreate(GalUtil_ThreadID *tid, void*(*func)(void*), void *arg)

void GalUtil_InitConditionVar(GalUtil_ConditionVar *condVar)

void GalUtil_DestroyConditionVar(GalUtil_ConditionVar *condVar)

void GalUtil_ConditionWait(GalUtil_ConditionVar *condVar, GalUtil_LocalMutex *mutex)

void GalUtil_ConditionBroadcast(GalUtil_ConditionVar *condVar)

void GalUtil_ThreadExit()

void GalUtil_InitMainWin32Thread()

int GalUtil_TryLockLocalMutex(GalUtil_LocalMutex *mutex)


Miscellaneous

int GalUtil_Mkdirp(const char *pathname, mode_t mode)
Cross-platform recursive directory creation function. Used in logging in the Hub.

void GalUtil_MilliSleep(int msecs)

int GalUtil_InitVerbose()
Called to initialize values for verbosity levels.


License / Documentation home / Help and feedback
Last updated June 21, 2002