#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <nsnet.h>
#include <nsutil.h>
#include <monitor.h>
#include <signal.h>
Go to the source code of this file.
Data Structures | |
struct | FDHandlerEntry |
Defines | |
#define | NUM_WRITEN 1 |
#define | NUM_READN 2 |
#define | NUM_MYREAD 3 |
#define | NUM_READLINE 4 |
#define | NUM_WRITEN2 5 |
#define | NUM_MAX 6 |
#define | NUM_QUIET |
#define | MAXHANDLER 1024 |
#define | MAXREAD 16384 |
Functions | |
void | addCount (int where) |
void | showCounts () |
int | isEOF (sock_t con, const struct InputBuffer *ib) |
const char * | stringifyErrorCode (int code) |
void | rshutdown (sock_t fd) |
void | setblocking (sock_t sock_fd) |
void | setnonblocking (sock_t sock_fd) |
sock_t | rsocket (void) |
void | sigPIPEHandler (int i) |
int | rinitNetworking (void) |
int | rbindAll (sock_t sock_fd) |
int | rconnectName (sock_t sock_fd, const char *hostname, unsigned short portno) |
sock_t | raccept (sock_t sock_fd) |
int | writeString (sock_t con, const char *buf, struct OutputBuffer *ob) |
int | rrecv (sock_t fd, char *read_buf, size_t count) |
int | writeBytes (sock_t con, const char *buf, int size, struct OutputBuffer *ob) |
void | initOutputBuffer (struct OutputBuffer *ob) |
void | initInputBuffer (struct InputBuffer *ib) |
int | my_read (sock_t fd, char *ptr, size_t maxlen, struct InputBuffer *ib) |
size_t | readn (sock_t fd, void *vptr, size_t len, struct InputBuffer *ib) |
size_t | writen (sock_t fd, const void *vptr, size_t len, struct OutputBuffer *ob) |
size_t | readlinebuf (void **vptrptr, struct InputBuffer *ib) |
int | inputBufferEmpty (const struct InputBuffer *ib) |
int | getOK (sock_t sock_fd, struct InputBuffer *ib) |
int | getResponseCode (sock_t sock_fd, struct InputBuffer *ib) |
Returns 1 if EOF. | |
int | rselect_timed (sock_t max_fd, fd_set *toread, fd_set *towrite, fd_set *toerr, struct timeval *tv) |
int | rselect (sock_t max_fd, fd_set *toread, fd_set *towrite, fd_set *toerr) |
int | readline (sock_t fd, char *vptr, size_t maxlen, struct InputBuffer *ib) |
int | findFdIndex (sock_t fd) |
Searches for a given socket fd in the handler table, fdTable, returning index or -1 if not found. | |
int | makeNewEntryForFD (sock_t fd, void(*handler)(void *uobj, const char *data, size_t len), void *uobj) |
int | setFdHandler (sock_t fd, void(*handler)(void *uobj, const char *data, size_t len), void *uobj) |
int | removeFdHandler (sock_t fd) |
int | handleReads (sock_t fd) |
Variables | |
unsigned int | cur [NUM_MAX] |
unsigned int | last [NUM_MAX] |
FDHandlerEntry | fdTable [MAXHANDLER] |
int | handlerCount |
|
Definition at line 560 of file nsnet.c. Referenced by makeNewEntryForFD(). |
|
Definition at line 623 of file nsnet.c. Referenced by handleReads(). |
|
Definition at line 49 of file nsnet.c. Referenced by addCount(), and showCounts(). |
|
Definition at line 45 of file nsnet.c. Referenced by my_read(). |
|
|
|
Definition at line 46 of file nsnet.c. Referenced by readline(). |
|
Definition at line 44 of file nsnet.c. Referenced by readn(). |
|
Definition at line 43 of file nsnet.c. Referenced by writen(). |
|
Definition at line 47 of file nsnet.c. Referenced by writen(). |
|
Definition at line 56 of file nsnet.c. Referenced by my_read(), readline(), readn(), and writen(). |
|
Searches for a given socket fd in the handler table, fdTable, returning index or -1 if not found. Searches fdTable for the given fd in the array. Returns index if found.
Definition at line 575 of file nsnet.c. References FDHandlerEntry::fd, fdTable, and handlerCount. Referenced by handleReads(), removeFdHandler(), and setFdHandler(). |
|
Definition at line 464 of file nsnet.c. References getResponseCode(), ib, rprintf(), and sock_fd. Referenced by main(). |
|
Returns 1 if EOF.
Definition at line 482 of file nsnet.c. References ib, isEOF(), MAXLEN, readline(), and sock_fd. |
|
Definition at line 624 of file nsnet.c. References fdTable, findFdIndex(), FDHandlerEntry::handler, MAXREAD, and rrecv(). |
|
Definition at line 362 of file nsnet.c. References ib. Referenced by makeNewClient(). |
|
Definition at line 357 of file nsnet.c. References ob. Referenced by makeNewClient(). |
|
Definition at line 459 of file nsnet.c. References ib, and InputBuffer::read_cnt. Referenced by main(). |
|
Definition at line 76 of file nsnet.c. References ib, and InputBuffer::isEOF. Referenced by getResponseCode(), idleHandler(), and main(). |
|
Definition at line 584 of file nsnet.c. References FDHandlerEntry::fd, fdTable, FDHandlerEntry::handler, handlerCount, MAXHANDLER, rprintf(), and FDHandlerEntry::uobj. Referenced by setFdHandler(). |
|
Definition at line 367 of file nsnet.c. References addCount(), ib, InputBuffer::isEOF, monitorLog(), NUM_MYREAD, PLACE_MYREAD, InputBuffer::read_buf, InputBuffer::read_cnt, InputBuffer::read_ptr, rprintf(), rrecv(), and showCounts(). Referenced by main(), and readline(). |
|
Definition at line 285 of file nsnet.c. References rprintf(), rsockaddr_t, sock_fd, sock_t, and stringifyErrorCode(). Referenced by main(). |
|
Definition at line 213 of file nsnet.c. References DEFAULTPORT, MAXCLIENTS, rexit(), rprintf(), rsockaddr_t, and sock_fd. Referenced by main(). |
|
Definition at line 244 of file nsnet.c. References hostent_t, monitorLog(), PLACE_CONNECT, rexit(), rprintf(), rsleep(), rsockaddr_t, and sock_fd. Referenced by main(). |
|
Definition at line 529 of file nsnet.c. References addCount(), ib, my_read(), NUM_READLINE, setblocking(), and showCounts(). Referenced by getResponseCode(), idleHandler(), and main(). |
|
Definition at line 452 of file nsnet.c. References ib, InputBuffer::read_cnt, and InputBuffer::read_ptr. |
|
Definition at line 409 of file nsnet.c. References addCount(), NUM_READN, and showCounts(). |
|
Definition at line 611 of file nsnet.c. References fdTable, findFdIndex(), and handlerCount. |
|
Definition at line 198 of file nsnet.c. References sigPIPEHandler(). Referenced by main(). |
|
Definition at line 315 of file nsnet.c. References monitorLog(), and PLACE_RRECV. Referenced by handleReads(), and my_read(). |
|
Definition at line 512 of file nsnet.c. References max_fd, monitorLog(), and PLACE_RSELECT. Referenced by idleHandler(), and main(). |
|
Definition at line 504 of file nsnet.c. References max_fd. Referenced by main(). |
|
Definition at line 124 of file nsnet.c. Referenced by main(). |
|
Definition at line 186 of file nsnet.c. References setnonblocking(), sock_fd, and sock_t. Referenced by main(). |
|
Definition at line 133 of file nsnet.c. References monitorLog(), PLACE_SETBLOCKING, rexit(), and sock_fd. Referenced by main(), readline(), and writeBytes(). |
|
Definition at line 598 of file nsnet.c. References fdTable, findFdIndex(), FDHandlerEntry::handler, makeNewEntryForFD(), and FDHandlerEntry::uobj. |
|
Definition at line 160 of file nsnet.c. References rexit(), rprintf(), and sock_fd. Referenced by rsocket(), and writeBytes(). |
|
Definition at line 62 of file nsnet.c. References cur, NUM_MAX, and rprintf(). Referenced by my_read(), readline(), readn(), and writen(). |
|
Definition at line 194 of file nsnet.c. Referenced by rinitNetworking(). |
|
Definition at line 81 of file nsnet.c. References buf, and OSTYPESTR. Referenced by monitorLog(), and raccept(). |
|
Definition at line 334 of file nsnet.c. References buf, MAXLEN, monitorLog(), PLACE_WRITEBYTES, rprintf(), setblocking(), and setnonblocking(). Referenced by main(), and writeString(). |
|
Definition at line 430 of file nsnet.c. References addCount(), NUM_WRITEN, NUM_WRITEN2, and showCounts(). Referenced by handleSamples(), and sendClientMsg(). |
|
Definition at line 310 of file nsnet.c. References buf, ob, and writeBytes(). Referenced by handleSamples(), and main(). |
|
Definition at line 54 of file nsnet.c. Referenced by addCount(), idleHandler(), main(), and showCounts(). |
|
Definition at line 567 of file nsnet.c. Referenced by findFdIndex(), handleReads(), makeNewEntryForFD(), removeFdHandler(), and setFdHandler(). |
|
Table of stream handlers * Definition at line 568 of file nsnet.c. Referenced by findFdIndex(), makeNewEntryForFD(), and removeFdHandler(). |
|
|