Index: ossp-pkg/sa/TODO RCS File: /v/ossp/cvs/ossp-pkg/sa/TODO,v rcsdiff -q -kk '-r1.40' '-r1.41' -u '/v/ossp/cvs/ossp-pkg/sa/TODO,v' 2>/dev/null --- TODO 2002/10/26 18:01:24 1.40 +++ TODO 2002/10/26 18:28:15 1.41 @@ -13,8 +13,6 @@ o more test cases to cover full API and especially the client/server usage - o more documentation to fully describe API - CANDO ----- Index: ossp-pkg/sa/sa.pod RCS File: /v/ossp/cvs/ossp-pkg/sa/sa.pod,v rcsdiff -q -kk '-r1.32' '-r1.33' -u '/v/ossp/cvs/ossp-pkg/sa/sa.pod,v' 2>/dev/null --- sa.pod 2002/10/26 17:59:30 1.32 +++ sa.pod 2002/10/26 18:28:16 1.33 @@ -618,26 +618,26 @@ This determines the address of the communication peer and creates a new socket address abstraction object (returned in I) describing the peer address. The application has to destroy I later with -sa_addr_destroy(3). +sa_addr_destroy(3). Internally this maps to getpeername(2). Example: C -=item sa_rc_t B(sa_t *I, sa_addr_t **I); +=item CBC<(sa_t *>IC<, sa_addr_t **>IC<);> Get address abstraction of local side of communication. This determines the address of the local communication side and creates a new socket address abstraction object (returned in I) describing the local address. The application has to destroy I -later with sa_addr_destroy(3). +later with sa_addr_destroy(3). Internally this maps to getsockname(2). Example: C -=item sa_rc_t B(sa_t *I, char *I); +=item CBC<(sa_t *>IC<, char *>IC<);> Shut down part of the full-duplex connection. -This performs a shut down of the connection descriped in I. The +This performs a shut down of the connection described in I. The flags string can be either "C" (indicating the read channel of the communication is shut down only), "C" (indicating the write channel of the communication is shut down only), or "C" (indicating both the @@ -655,7 +655,7 @@ =over 4 -=item sa_rc_t B(sa_t *I, int *I); +=item CBC<(sa_t *>IC<, int *>IC<);> Get underlying socket filedescriptor. @@ -672,37 +672,123 @@ Example: C -=item sa_rc_t B(sa_t *I, char *I, size_t I, size_t *I); +=item CBC<(sa_t *>IC<, char *>IC<, size_t >IC<, size_t *>IC<);> -=item sa_rc_t B(sa_t *I, char *I, size_t I, size_t *I); +Read a chunk of data from socket into own buffer. -=item sa_rc_t B(sa_t *I, const char *I, size_t I, size_t *I); +This reads from the socket (optionally through the internal read buffer) +up to a maximum of I bytes into buffer I. The actual number +of read bytes is stored in I. This internally maps to read(2). -=item sa_rc_t B(sa_t *I, const char *I, ...); +Example: C -=item sa_rc_t B(sa_t *I); +=item CBC<(sa_t *>IC<, char *>IC<, size_t >IC<, size_t *>IC<);> + +Read a line of data from socket into own buffer. + +This reads from the socket (optionally through the internal read buffer) +up to a maximum of I bytes into buffer I, but only as long +as no line terminating newline character (0x0a) was found. The line +terminating newline character is stored in the buffer, too. The actual +number of read bytes is stored in I. This internally maps to +sa_read(3). + +Keep in mind that for efficiency reasons, line-oriented I/O usually +always should be performed with read buffer (see sa_option(3) and +C). Without such a read buffer, the performance is +cruel, because single character read(2) operations would be performed on +the underlying socket. + +Example: C + +=item CBC<(sa_t *>IC<, const char *>IC<, size_t >IC<, size_t *>IC<);> + +Write a chunk of data to socket from own buffer. + +This writes to the socket (optionally through the internal write buffer) +I bytes from buffer I. In case of a partial write, the +actual number of written bytes is stored in I. This internally +maps to write(2). + +Example: C + +=item CBC<(sa_t *>IC<, const char *>IC<, ...);> + +Write formatted data data to socket. + +This formats a string according to the printf(3)-style format +specification I and sends the result to the socket (optionally +through the internal write buffer). In case of a partial socket +write, the not written data of the formatted string is internally +discarded. Hence using a write buffer is strongly recommended here +(see sa_option(3) and C). This internally maps to +sa_write(3). + +The underlying string formatting engine is just a minimal one and for +security and independence reasons intentionally not directly based on +s[n]printf(3). It understands only the following format specifications: +"C<%%>", "C<%c>" (C), "C<%s>" (C) and "C<%d>" (C) +without any precision and padding possibilities. It is intended for +minimal formatting only. If you need more sophisticated formatting, you +have to format first into an own buffer via s[n]printf(3) and then write +this to the socket via sa_write(3) instead. + +Example: C + +=item CBC<(sa_t *>IC<);> + +Flush still pending outgoing data to socket. + +This writes all still pending outgoing data for the internal write +buffer (see sa_option(3) and C) to the socket. This +internally maps to write(2). + +Example: C =back =head2 Socket Input/Output Operations (Datagram Communication) -This API part provides operations for datagram-oriented data +This API part provides I/O operations for datagram-oriented data communication through the socket abstraction C. =over 4 =item sa_rc_t B(sa_t *I, char *I, size_t I, size_t *I, sa_addr_t **I); +Receive a chunk of data from remote address via socket into own buffer. + +This receives from the remote address specified in I via the +socket up to a maximum of I bytes into buffer I. The actual +number of received bytes is stored in I. This internally maps +to recvfrom(2). + +Example: C + =item sa_rc_t B(sa_t *I, const char *I, size_t I, size_t *I, sa_addr_t *I); +Send a chunk of data to remote address via socket from own buffer. + +This sends to the remote address specified in I via the socket +I bytes from buffer I. The actual number of sent bytes is +stored in I. This internally maps to sendto(2). + +Example: C + =back =head2 Socket Error Handling +This API part provides error handling operations only. + =over 4 =item char *B(sa_rc_t I); +Return the string representation corresponding to the return code +value I. The returned string has to be treated read-only by the +application and is not required to be deallocated. + =back =head1 SEE ALSO @@ -710,43 +796,43 @@ =head2 Standards R. Gilligan, S. Thomson, J. Bound, W. Stevens: -"Basic Socket Interface Extensions for IPv6", -RFC 2553, March 1999. +I<"Basic Socket Interface Extensions for IPv6">, +B, March 1999. W. Stevens: -"Advanced Sockets API for IPv6", +I<"Advanced Sockets API for IPv6">, B, February 1998. R. Fielding, L. Masinter, T. Berners-Lee: -"Uniform Resource Identifiers: Generic Syntax", +I<"Uniform Resource Identifiers: Generic Syntax">, B, August 1998. R. Hinden, S. Deering: -"IP Version 6 Addressing Architecture", +I<"IP Version 6 Addressing Architecture">, B, July 1998. R. Hinden, B. Carpenter, L. Masinter: -"Format for Literal IPv6 Addresses in URL's", +I<"Format for Literal IPv6 Addresses in URL's">, B, December 1999. =head2 Papers Stuart Sechrest: -"An Introductory 4.4BSD Interprocess Communication Tutorial", +I<"An Introductory 4.4BSD Interprocess Communication Tutorial">, FreeBSD 4.4 (/usr/share/doc/psd/20.ipctut/). Samuel J. Leffler, Robert S. Fabry, William N. Joy, Phil Lapsley: -"An Advanced 4.4BSD Interprocess Communication Tutorial", +I<"An Advanced 4.4BSD Interprocess Communication Tutorial">, FreeBSD 4.4 (/usr/share/doc/psd/21.ipc/). Craig Metz: -"Protocol Independence Using the Sockets API" +I<"Protocol Independence Using the Sockets API">, http://www.usenix.org/publications/library/proceedings/usenix2000/freenix/metzprotocol.html, USENIX Annual Technical Conference, June 2000. =head2 Manual Pages -socket(2) +socket(2), accept(2), bind(2), connect(2), @@ -763,7 +849,7 @@ socketpair(2), write(2), getprotoent(3), -protocols(4) +protocols(4). =head1 HISTORY @@ -775,7 +861,7 @@ derived from a predecessor sub-library originally written for socket address abstraction inside B. -=head1 AUTHORS +=head1 AUTHOR Ralf S. Engelschall rse@engelschall.com