#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <err.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
#include "socket99.h"
#include "util.h"
#include <poll.h>
Go to the source code of this file.
|
static void | init_polling (config *cfg) |
|
static void | open_ports (config *cfg) |
|
static void | handle_incoming_connections (config *cfg, int available) |
|
static void | handle_client_io (config *cfg, int available) |
|
static void | listen_loop_poll (config *cfg) |
|
static void | register_client (config *cfg, int cfd, struct sockaddr *addr, socklen_t addr_len) |
|
static void | disconnect_client (config *cfg, int fd) |
|
static void | enqueue_write (config *cfg, int fd, uint8_t *buf, size_t write_size) |
|
static void | usage (void) |
|
static void | parse_args (int argc, char **argv, config *cfg) |
|
int | main (int argc, char **argv) |
|
static void | tick_handler (config *cfg) |
|
|
static uint8_t | read_buf [(2 *1024L *1024)] |
|
#define BUF_SZ (2 * 1024L * 1024) |
#define NO_CLIENT ((int)-1) |
#define LOG |
( |
|
VERBOSITY, |
|
|
|
... |
|
) |
| |
Value:do { \
if (VERBOSITY <= cfg->verbosity) { \
printf(__VA_ARGS__); \
} \
} \
while(0)
Definition at line 46 of file echosrv.c.
static void init_polling |
( |
config * |
cfg | ) |
|
|
static |
static void open_ports |
( |
config * |
cfg | ) |
|
|
static |
static void handle_incoming_connections |
( |
config * |
cfg, |
|
|
int |
available |
|
) |
| |
|
static |
static void handle_client_io |
( |
config * |
cfg, |
|
|
int |
available |
|
) |
| |
|
static |
static void listen_loop_poll |
( |
config * |
cfg | ) |
|
|
static |
static void register_client |
( |
config * |
cfg, |
|
|
int |
cfd, |
|
|
struct sockaddr * |
addr, |
|
|
socklen_t |
addr_len |
|
) |
| |
|
static |
static void disconnect_client |
( |
config * |
cfg, |
|
|
int |
fd |
|
) |
| |
|
static |
static void enqueue_write |
( |
config * |
cfg, |
|
|
int |
fd, |
|
|
uint8_t * |
buf, |
|
|
size_t |
write_size |
|
) |
| |
|
static |
static void usage |
( |
void |
| ) |
|
|
static |
static void parse_args |
( |
int |
argc, |
|
|
char ** |
argv, |
|
|
config * |
cfg |
|
) |
| |
|
static |
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
static void tick_handler |
( |
config * |
cfg | ) |
|
|
static |
uint8_t read_buf[(2 *1024L *1024)] |
|
static |