
wrapsock.h File Reference
Headers for tcpcli, tcpserv, wrapsock. More...
Go to the source code of this file.
#include <stdio.h>
fprintf, snprintf, strerror, fflush, fputs, sscanf,fgets, ferror, printf, vsnprintf, fileno, stdout, stderr, FILE, EOF
#include <stdlib.h>
exit, EXIT_SUCCESS, EXIT_FAILURE
#include <sys/socket.h>
accept, connect, bind, listen, socket, shutdown, SHUT_WR
#include <string.h>
strcpy, bzero, strlen, strcat, strerror
#include <unistd.h>
getpid, getopt, fork, read, close, write, select
#include <sys/errno.h>
errno, EINTR
#include <arpa/inet.h>
htons, htonl, inet_pton
#include <netinet/in.h>
storage size of struct address, INADDR_ANY
#include <stdarg.h>
va_list, va_start, va_end
#include <syslog.h>
syslog, LOG_ERR
#include <sys/wait.h>
waitpid, WNOHANG
#include <math.h>
pow
#include <ctype.h>
isupper, isdigit, tolower
typedef void Sigfunc (int)
Convenient definition to make it easier to read the code.
#define socklen_t unsigned int
defined before the right type get a chance to be defined.
#define SERV_PORT1 9877
port to handle all requests.
#define SERV_PORT2 9878
port to handle numeric requests.
#define SERV_PORT3 9879
port to handle word conversion.
#define MAXLINE 4096
length of a line.
#define LISTENQ 128
maximum number of pending connections.
#define SA struct sockaddr
convenience to make it easier to read the code.
#define MGMAX(a,b) (((a) > (b)) ? (a) : (b))
returns the maximum of a and b.
void cliusage (char *)
void Inet_pton (int, const char *, void *)
void Connect (int, const struct sockaddr *, socklen_t)
void str_cli (FILE *, int)
void servusage (char *)
void Bind (int, const struct sockaddr *, socklen_t)
void Listen (int, int)
Sigfunc * Signal (int, Sigfunc *)
pid_t Fork (void)
void Close (int)
void str_serv1 (int)
void str_serv2 (int)
void str_serv3 (int)
int Socket (int, int, int)
char * Fgets (char *, int, FILE *)
ssize_t mg_readline (int, void *, size_t)
ssize_t Readline (int, void *, size_t)
void Fputs (const char *, FILE *)
ssize_t writen (int, const void *, size_t)
void Writen (int, void *, size_t)
Sigfunc * mg_signal (int, Sigfunc *)
int Select (int, fd_set *, fd_set *, fd_set *, struct timeval *)
void Shutdown (int, int)
void err_sys (const char *fmt,...)
void err_quit (const char *fmt,...)
char * optarg = 0
points to the option argument supplied by the user.
int optind = 0
index of the next argument on return.
int optopt = 0
last known option on return.
int opterr = 0
on return error.
int optreset = 0
not used here.
Headers for tcpcli, tcpserv, wrapsock.
- Global variables for checking options
- Constants used in all modules
- Wrappers for primitives with error checking
- Specific functions used in client and server
- Functions for read and write operations
Definitions of functions in file wrapsock.c
Documentation in file wrapsock.c Reference