--- sa.h 2001/10/05 11:49:10 1.6
+++ sa.h 2001/10/05 20:52:15 1.7
@@ -30,7 +30,7 @@
#ifndef __SA_H__
#define __SA_H__
-/* system definitions of "size_t", "socklen_t", "struct sockaddr" */
+/* system definitions of "size_t", "socklen_t", "struct sockaddr *" */
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -96,11 +96,12 @@
/* return codes */
typedef enum {
SA_OK,
- SA_ERR_ARG,
- SA_ERR_USE,
- SA_ERR_MEM,
- SA_ERR_SYS,
- SA_ERR_INT
+ SA_ERR_ARG, /* invalid argument (wrong parameter) */
+ SA_ERR_USE, /* invalid use (wrong context) */
+ SA_ERR_MEM, /* out of memory */
+ SA_ERR_SYS, /* system error (see errno) */
+ SA_ERR_EOF, /* end of file/socket communication */
+ SA_ERR_INT /* internal error */
} sa_rc_t;
/* address object operations */
@@ -121,8 +122,6 @@
sa_rc_t sa_type (sa_t *sa, sa_type_t type);
sa_rc_t sa_timeout (sa_t *sa, long sec, long usec);
sa_rc_t sa_buffers (sa_t *sa, size_t rsize, size_t wsize);
-sa_rc_t sa_getoption (sa_t *sa, int optname, void *optval, socklen_t *optlen);
-sa_rc_t sa_setoption (sa_t *sa, int optname, const void *optval, socklen_t optlen);
/* socket connection operations */
sa_rc_t sa_bind (sa_t *sa, sa_addr_t *laddr);
@@ -134,14 +133,16 @@
sa_rc_t sa_getfd (sa_t *sa, int *fd);
sa_rc_t sa_shutdown (sa_t *sa, char *flags);
-/* socket input/output operations */
+/* socket input/output operations (stream communication) */
sa_rc_t sa_read (sa_t *sa, char *buf, size_t buflen, size_t *bufdone);
-sa_rc_t sa_readfrom (sa_t *sa, char *buf, size_t buflen, size_t *bufdone, sa_addr_t **raddr);
-sa_rc_t sa_readline (sa_t *sa, char *buf, size_t buflen, size_t *bufdone);
+sa_rc_t sa_readln (sa_t *sa, char *buf, size_t buflen, size_t *bufdone);
sa_rc_t sa_write (sa_t *sa, const char *buf, size_t buflen, size_t *bufdone);
-sa_rc_t sa_writeto (sa_t *sa, const char *buf, size_t buflen, size_t *bufdone, sa_addr_t *raddr);
sa_rc_t sa_writef (sa_t *sa, const char *fmt, ...);
sa_rc_t sa_flush (sa_t *sa);
+/* socket input/output operations (datagram communication) */
+sa_rc_t sa_recv (sa_t *sa, char *buf, size_t buflen, size_t *bufdone, sa_addr_t **raddr);
+sa_rc_t sa_send (sa_t *sa, const char *buf, size_t buflen, size_t *bufdone, sa_addr_t *raddr);
+
#endif /* __SA_H__ */
|