Line 1:
Line 1:
−
nsysnet.rpl is the library that provides Berkeley sockets (BSD sockets) related functions. You can find more information about it on [http://en.wikipedia.org/wiki/Berkeley_sockets Wikipedia]
+
nsysnet.rpl is the library that provides Berkeley sockets (BSD sockets), network configuration, and SSL functions. You can find more information about BSD sockets on [http://en.wikipedia.org/wiki/Berkeley_sockets Wikipedia]
==Functions==
==Functions==
−
===Base===
+
===Socket===
+
Many of these socket functions are standard BSD calls (connect(), recv(), send(), etc.), and behave the same.
{| class="wikitable"
{| class="wikitable"
!Name
!Name
Line 9:
Line 10:
!Returns
!Returns
|-
|-
−
|SOInit
+
|socket_lib_init
−
|<code>int SOInit(void);</code>
+
|<code>int socket_lib_init(void);</code>
−
|Initializes the library.
+
|Initialize the library
|SO_*
|SO_*
|-
|-
−
|SOFinish
+
|socket_lib_finish
−
|<code>int SOFinish(void);</code>
+
|<code>int socket_lib_init(void);</code>
−
|Cleans up after the library.
+
|Clean up after the library
|SO_*
|SO_*
−
|}
−
−
===Networking===
−
These are also available under their standard BSD names (connect(), recv(), send(), etc.), without the SO* prefix.
−
{| class="wikitable"
−
!Name
−
!Prototype
−
!Description
−
!Returns
|-
|-
−
|SOConnect
+
|connect
−
|<code>int SOConnect(int fd, struct sockaddr *addr, int addrlen);</code>
+
|<code>int connect(int fd, struct sockaddr *addr, int addrlen);</code>
−
|Connects to the defined target
+
|Connect to the specified host
|SO_*
|SO_*
|-
|-
−
|SOListen
+
|listen
−
|<code>int SOListen(int fd, int backlog);</code>
+
|<code>int listen(int fd, int backlog);</code>
−
|Listens for connections
+
|Listen for connections
|SO_*
|SO_*
|-
|-
−
|SOAccept
+
|accept
−
|<code>int SOAccept(int fd, struct sockaddr *addr, int *addrlen);</code>
+
|<code>int accept(int fd, struct sockaddr *addr, int *addrlen);</code>
−
|Initializes/Accepts connection requests from listing
+
|Accept connection requests from listening
−
|A new socket descriptor???
+
|A new socket descriptor
|-
|-
−
|SORecv
+
|recv
−
|<code>int SORecv(int fd, void *buffer, int len, int flags);</code>
+
|<code>int recv(int fd, void *buffer, int len, int flags);</code>
−
|Receive data from a remote socket
+
|Receive data over a socket
|SO_*
|SO_*
|-
|-
−
|SORecvFrom
+
|recvfrom
−
|<code>int SORecvFrom(int fd, void *buffer, int len, int flags, struct sockaddr *from, int *fromlen);</code>
+
|<code>int recvfrom(int fd, void *buffer, int len, int flags, struct sockaddr *from, int *fromlen);</code>
−
|Same as SORecv but with target specified
+
|Same as recv() but with target specified
|SO_*
|SO_*
|-
|-
−
|SOSend
+
|send
−
|<code>int SOSend(int fd, const void *buffer, int len, int flags);</code>
+
|<code>int send(int fd, const void *buffer, int len, int flags);</code>
−
|Send data to remote socket
+
|Send data over a socket
|SO_*
|SO_*
|-
|-
−
|SOSendTo
+
|sendto
−
|<code>int SOSendTo(int fd, const void *buffer, int len, int flags, const struct sockaddr *dest_addr, int dest_len);</code>
+
|<code>int sendto(int fd, const void *buffer, int len, int flags, const struct sockaddr *dest_addr, int dest_len);</code>
−
|Same as SOSend but with target specified
+
|Same as send() but with target specified
|SO_*
|SO_*
−
|}
−
−
===Error===
−
{| class="wikitable"
−
!Name
−
!Prototype
−
!Description
−
!Returns
|-
|-
−
|SOInit
+
|socklasterr
−
|<code>int SOLastError(void);</code>
+
|<code>int socklasterr(void);</code>
−
|Recives the latest error???
+
|Return the most recently recorded socket error code
−
|The latest error(SO_*)???
+
|The latest error(SO_*)
|}
|}
Line 85:
Line 69:
|
|
<syntaxhighlight lang="C">
<syntaxhighlight lang="C">
−
typedef struct {
+
typedef struct
+
{
u16 sin_family;
u16 sin_family;
u16 sin_port;
u16 sin_port;