#include <malloc.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <nsnet.h>
#include <fcntl.h>
#include <assert.h>
#include <neuro/neuro.h>
#include <neuro/ns2net.h>
Go to the source code of this file.
Data Structures | |
struct | NSNet |
struct | NSNetBindHandlerInternal |
struct | NSNetConnectionController |
struct | NSNetConnectionHandlerInternal |
struct | NSNetReadHandlerInternal |
Defines | |
#define | MAXCONN 256 |
Functions | |
int | attachConnectionReadHandler (struct NSNetConnectionController *nscc, const struct NSNetConnectionReadHandler *nscch, void *udata) |
Attaches a struct NSNetConnectionReadHandler to a live network connetion. | |
int | attemptBind (struct NSNet *ns, const struct NSNetBindHandler *nsb, int isLocalOnly, unsigned short portNum, void *udata) |
Performs an asynchronous bind on a network port and begins listening for connections. | |
int | setNSnonblocking (struct NSNet *ns, sock_t sock_fd) |
int | attemptConnect (struct NSNet *ns, const struct NSNetConnectionHandler *nsc, const char *destaddr, unsigned short destPort, void *udata) |
Creates a new socket and initiates an asychronous connection request to the specified hostname and port. | |
void | waitForNetEvent (struct NSNet *ns, int timeout) |
Waits for a network event to arrive, and dispatches it, or times out. | |
NSNet * | newNSNet (void) |
Initializes networking in a system-independent way. | |
void | closeNSNet (struct NSNet *ns) |
Closes an NSNet interface, freeing the memory and other resources associated with it. | |
int | closeConnection (struct NSNetConnectionController *nscc) |
Closes a network connection. | |
int | writeNSBytes (struct NSNetConnectionController *nscc, void *buf, int len) |
Writes a number of bytes to a network connection. |
|
|
|
Attaches a struct NSNetConnectionReadHandler to a live network connetion.
Definition at line 62 of file ns2net.c. References NSNetConnectionController::fd, NSNetConnectionController::ns, and putInt(). |
|
Performs an asynchronous bind on a network port and begins listening for connections.
Definition at line 78 of file ns2net.c. References NSNet::bindMap, NSNetBindHandler::error, MAXCLIENTS, putInt(), rsockaddr_t, sock_fd, and sock_t. |
|
Creates a new socket and initiates an asychronous connection request to the specified hostname and port.
Definition at line 203 of file ns2net.c. References NSNet::connectMap, putInt(), rassert, rsockaddr_t, setNSnonblocking(), sock_t, and NSNetConnectionHandler::success. |
|
Closes a network connection.
Definition at line 372 of file ns2net.c. References NSNetConnectionController::fd. |
|
Closes an NSNet interface, freeing the memory and other resources associated with it.
Definition at line 364 of file ns2net.c. References NSNet::bindMap, NSNet::connectMap, freeStringTable(), and NSNet::readerMap. |
|
Initializes networking in a system-independent way.
Definition at line 351 of file ns2net.c. References newStringTable(). |
|
Definition at line 141 of file ns2net.c. References sock_fd. Referenced by attemptConnect(), and waitForNetEvent(). |
|
Waits for a network event to arrive, and dispatches it, or times out.
Definition at line 273 of file ns2net.c. References NSNet::bindMap, buf, NSNet::connectMap, NSNet::errfds, findInt(), NSNet::max_fd, max_fd, NSNet::readerMap, NSNet::readfds, setNSnonblocking(), sock_t, and NSNet::writefds. |
|
Writes a number of bytes to a network connection.
Definition at line 378 of file ns2net.c. References buf, and NSNetConnectionController::fd. |