| 1 |
#ifndef SERVER_UTILS_H |
|---|
| 2 |
#define SERVER_UTILS_H |
|---|
| 3 |
|
|---|
| 4 |
#include <poll.h> |
|---|
| 5 |
#include <pthread.h> |
|---|
| 6 |
#include <arpa/inet.h> |
|---|
| 7 |
#include <errno.h> |
|---|
| 8 |
#include <string.h> |
|---|
| 9 |
#include <sys/types.h> |
|---|
| 10 |
#include <signal.h> |
|---|
| 11 |
#include <unistd.h> |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
void w_listen(int s,int b); |
|---|
| 15 |
int w_poll(struct pollfd *p, int n, int timeout); |
|---|
| 16 |
void w_pthread_cond_signal(pthread_cond_t *cond); |
|---|
| 17 |
void w_pthread_mutex_lock(pthread_mutex_t *m); |
|---|
| 18 |
void w_pthread_mutex_unlock(pthread_mutex_t *m); |
|---|
| 19 |
void w_pthread_mutex_lock_unlock(pthread_mutex_t *m); |
|---|
| 20 |
void w_pthread_create(pthread_t *t,pthread_attr_t *a,void *(*f)(void*), void *arg); |
|---|
| 21 |
void w_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *m); |
|---|
| 22 |
void w_pthread_cond_wait_unlock(pthread_cond_t *cond, pthread_mutex_t *m); |
|---|
| 23 |
void w_pthread_attr_init(pthread_attr_t *a); |
|---|
| 24 |
void w_pthread_attr_setdetachstate(pthread_attr_t *a,int s); |
|---|
| 25 |
void w_pthread_attr_destroy(pthread_attr_t *a); |
|---|
| 26 |
void w_pthread_mutex_init(pthread_mutex_t *t,pthread_mutexattr_t *a); |
|---|
| 27 |
void w_pthread_mutex_destroy(pthread_mutex_t *t); |
|---|
| 28 |
void w_pthread_cond_init(pthread_cond_t *c,pthread_condattr_t *a); |
|---|
| 29 |
int any_sockaddr(struct sockaddr *sa,int family); |
|---|
| 30 |
void w_setsockopt(int s,int lvl,int opt,void *optval,socklen_t optlen); |
|---|
| 31 |
void w_setsockopt_reuseaddr(int s); |
|---|
| 32 |
int w_accept(int skt,struct sockaddr *sa, socklen_t *salen); |
|---|
| 33 |
const char* w_inet_ntop(struct sockaddr *s, socklen_t slen, char *buf, int buflen); |
|---|
| 34 |
int w_socket(int family,int type, int proto,int die); |
|---|
| 35 |
#endif |
|---|