diff --git a/exercises/ex04/trout/util.h b/exercises/ex04/trout/util.h new file mode 100644 index 00000000..b04ff27b --- /dev/null +++ b/exercises/ex04/trout/util.h @@ -0,0 +1,48 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAXLINE 4096 + +/* the following are a few definitions from Stevens' unp.h */ +typedef void Sigfunc(int); /* for signal handlers */ + +void err_sys (char *fmt, ...); +void err_quit (char *fmt, ...); +char *Sock_ntop_host(const struct sockaddr *sa, socklen_t salen); +int sock_cmp_addr(const struct sockaddr *sa1, + const struct sockaddr *sa2, socklen_t salen); +void sock_set_port(struct sockaddr *sa, socklen_t salen, int port); +void tv_sub (struct timeval *out, struct timeval *in); +char *icmpcode_v4(int code); +Sigfunc *Signal(int signo, Sigfunc *func); +void *Calloc(size_t n, size_t size); +void Gettimeofday(struct timeval *tv, void *foo); +void Pipe(int *fds); +void Bind(int fd, const struct sockaddr *sa, socklen_t salen); +void Setsockopt(int fd, int level, int optname, const void *optval, + socklen_t optlen); +struct addrinfo *Host_serv(const char *host, const char *serv, + int family, int socktype); +ssize_t Read(int fd, void *ptr, size_t nbytes); +void Write(int fd, void *ptr, size_t nbytes); +ssize_t Recvfrom(int fd, void *ptr, size_t nbytes, int flags, + struct sockaddr *sa, socklen_t *salenptr);