aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-09-06 20:47:14 +0000
committerdos-reis <gdr@axiomatics.org>2008-09-06 20:47:14 +0000
commit95440288d1c686ceda247fcf606576deb8367d0a (patch)
tree48b3b2b3c64cd2400db5826bf4f5617ec9572eee /src/include
parentc8bfb04b762ad0e33272fd082457aa524d542fca (diff)
downloadopen-axiom-95440288d1c686ceda247fcf606576deb8367d0a.tar.gz
* interp/sys-os.boot (openIP4ClientStreamSocket): New.
(readFromStreamSocket): Likewise. (writeToStreamSocket): Likewise. (closeSocket): Likewise. * include/sockio.h: Include <arpa/inet.h> (oa_open_ip4_client_stream_socket): Declare. (oa_socket_write): Likewise. (oa_socket_read): Likewise. * lib/sockio-c.c (openaxiom_unload_socket_module): New. (openaxiom_load_socket_module): Tidy. (openaxiom_socket_is_invalid): New. (is_invalid_socket): Use it. (oa_open_ip4_client_stream_socket): Define. (oa_socket_read): Likewise. (oa_socket_write): Likewise.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/sockio.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/include/sockio.h b/src/include/sockio.h
index 50fe3287..15202d93 100644
--- a/src/include/sockio.h
+++ b/src/include/sockio.h
@@ -40,11 +40,14 @@
#ifdef __MINGW32__
# include <winsock2.h>
+# define OPENAXIOM_INVALID_SOCKET INVALID_SOCKET
#else
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
+# include <arpa/inet.h>
# include <sys/un.h>
+# define OPENAXIOM_INVALID_SOCKET (-1)
#endif
#include "openaxiom-c-macros.h"
@@ -61,7 +64,7 @@ typedef SOCKET openaxiom_socket;
#else
typedef int openaxiom_socket;
#endif
-
+typedef int openaxiom_port;
typedef struct openaxiom_sio {
openaxiom_socket socket; /* descriptor of this socket I/O endpoint. */
@@ -82,6 +85,13 @@ typedef struct openaxiom_sio {
OPENAXIOM_EXPORT int oa_open_local_client_stream_socket(const char*);
OPENAXIOM_EXPORT int oa_open_local_server_stream_socket(const char*);
+OPENAXIOM_EXPORT openaxiom_socket
+oa_open_ip4_client_stream_socket(const char*, openaxiom_port);
+OPENAXIOM_EXPORT int oa_socket_write(openaxiom_socket,
+ const openaxiom_byte*, int);
+OPENAXIOM_EXPORT int oa_socket_read(openaxiom_socket,
+ openaxiom_byte*, int);
+OPENAXIOM_EXPORT void oa_close_socket(openaxiom_socket);
OPENAXIOM_EXPORT int oa_filedesc_write(int, const openaxiom_byte*, int);
OPENAXIOM_EXPORT int oa_filedesc_read(int, openaxiom_byte*, int);
@@ -104,7 +114,6 @@ OPENAXIOM_EXPORT int open_server(const char*);
OPENAXIOM_EXPORT int accept_connection(openaxiom_sio*);
OPENAXIOM_EXPORT int sselect(int, fd_set*, fd_set*, fd_set*, void*);
OPENAXIOM_EXPORT void close_socket(openaxiom_socket, const char*);
-OPENAXIOM_EXPORT void axiom_close_socket(openaxiom_socket);
OPENAXIOM_EXPORT int get_int(openaxiom_sio*);
OPENAXIOM_EXPORT double get_float(openaxiom_sio*);