socket_xsb.c File Reference

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#include "wind2unix.h"
#include "xsb_time.h"
#include <sys/socket.h>
#include <sys/uio.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
#include "xsb_config.h"
#include "xsb_debug.h"
#include "socket_xsb.h"
#include "flags_xsb.h"
#include "thread_xsb.h"
#include "thread_defs_xsb.h"
#include "timer_xsb.h"
#include "auxlry.h"
#include "cell_xsb.h"
#include "error_xsb.h"
#include "cinterf.h"
#include "basictypes.h"
#include "io_builtins_xsb.h"
#include "psc_xsb.h"
#include "register.h"
#include "memory_xsb.h"

Data Structures

struct  connection_t

Functions

static xsbBool set_error_code (CTXTdeclc int ErrCode, int ErrCodeArgNumber, char *Where)
FILE * fdopen (int fildes, const char *type)
static void init_connections (CTXTdecl)
static void set_sockfd (int count)
static xsbBool list_sockfd (prolog_term list, fd_set *fdset, int *max_fd, int **fds, int *size)
static void test_ready (CTXTdeclc prolog_term *avail_sockfds, fd_set *fdset, int *fds, int size)
static void select_destroy (char *connection_name)
static int getsize (prolog_term list)
static int checkslot (void)
static char * get_host_IP (char *host_name_or_IP)
static int translate_domain (int xsb_domain, int *socket_domain)
int read_select (SOCKET sock_handle, int timeout)
int write_select (SOCKET sock_handle, int timeout)
static int readmsg (SOCKET sock_handle, char **msg_buff, unsigned long *msg_len)
static int socket_accept (CTXTdeclc SOCKET *sock_handle, int timeout)
static int socket_connect (CTXTdeclc int *rc, int timeout)
static int socket_recv (CTXTdeclc int *rc, char **buffer, unsigned long *buffer_len, int timeout)
static int socket_send (CTXTdeclc int *rc, int timeout)
static int socket_get0 (CTXTdeclc int *rc, char *message_read, int timeout)
static int socket_put (CTXTdeclc int *rc, int timeout)
xsbBool xsb_socket_request (CTXTdecl)

Variables

static u_long block_true = 1
static u_long block_false = 0
static struct connection_t connections [MAXCONNECT]

Function Documentation

static int checkslot void   )  [static]
 

FILE* fdopen int  fildes,
const char *  type
 

static char* get_host_IP char *  host_name_or_IP  )  [static]
 

static int getsize prolog_term  list  )  [static]
 

static void init_connections CTXTdecl   )  [static]
 

static xsbBool list_sockfd prolog_term  list,
fd_set *  fdset,
int max_fd,
int **  fds,
int size
[static]
 

int read_select SOCKET  sock_handle,
int  timeout
 

Calls select() on the socked specified by sock_handle, waiting for at most timeout seconds. Returns non-zero if a call to read() will return immediately, zero otherwise.

static int readmsg SOCKET  sock_handle,
char **  msg_buff,
unsigned long *  msg_len
[static]
 

static void select_destroy char *  connection_name  )  [static]
 

static xsbBool set_error_code CTXTdeclc int  ErrCode,
int  ErrCodeArgNumber,
char *  Where
[static]
 

static void set_sockfd int  count  )  [static]
 

static int socket_accept CTXTdeclc SOCKET *  sock_handle,
int  timeout
[static]
 

static int socket_connect CTXTdeclc int rc,
int  timeout
[static]
 

this may not set domain to a valid value; in this case the connect() will fail

static int socket_get0 CTXTdeclc int rc,
char *  message_read,
int  timeout
[static]
 

static int socket_put CTXTdeclc int rc,
int  timeout
[static]
 

static int socket_recv CTXTdeclc int rc,
char **  buffer,
unsigned long *  buffer_len,
int  timeout
[static]
 

static int socket_send CTXTdeclc int rc,
int  timeout
[static]
 

static void test_ready CTXTdeclc prolog_term avail_sockfds,
fd_set *  fdset,
int fds,
int  size
[static]
 

static int translate_domain int  xsb_domain,
int socket_domain
[static]
 

Translates from the XSB-defined value for a socket domains specified by xsb_domain to system-specific value for that socket domains and stores this system-specific value in socket_domain. Returns TRUE if the conversion was successful, FALSE otherwise.

int write_select SOCKET  sock_handle,
int  timeout
 

Calls select() on the socked specified by sock_handle, waiting for at most timeout seconds. Returns non-zero if a call to write() will return immediately, zero otherwise.

xsbBool xsb_socket_request CTXTdecl   ) 
 


Variable Documentation

u_long block_false = 0 [static]
 

u_long block_true = 1 [static]
 

struct connection_t connections[MAXCONNECT] [static]
 


Generated on Wed Jul 26 13:26:54 2006 for XSB by  doxygen 1.4.5