chiark / gitweb /
3fab1afa41ded6b879f26ecc0f46d7ac7e441bb9
[adns.git] / src / harness.h
1 /*
2  * harness.h
3  * - complex test harness function declarations, not part of the library
4  */
5 /*
6  *  This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson
7  *  
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2, or (at your option)
11  *  any later version.
12  *  
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *  
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software Foundation,
20  *  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
21  */
22
23 #ifndef HARNESS_H_INCLUDED
24 #define HARNESS_H_INCLUDED
25
26 #include <sys/time.h>
27 #include <unistd.h>
28
29 /* We override several system calls with #define's */
30
31 int Hgettimeofday(struct timeval *tv, struct timezone *tz);
32 int Hselect(int n, fd_set reads, fd_set writes, fd_set excepts, struct timeval *to);
33
34 int Hsocket(int domain, int type, int protocol);
35 int Hfcntl(int fd, int cmd, long arg);
36 int Hconnect(int fd, struct sockaddr *addr, int addrlen);
37 int Hclose(int fd);
38
39 int Hsendto(int fd, const void *msg, int msglen, unsigned int flags,
40             const struct sockaddr *addr, int addrlen);
41 int Hrecvfrom(int fd, void *buf, int buflen, unsigned int flags,
42               struct sockaddr *addr, int *addrlen);
43
44 int Hread(int fd, void *buf, size_t len);
45 int Hwrite(int fd, const void *buf, size_t len);
46
47 /* There is a Q function (Q for Question) for each such syscall;
48  * it constructs a string representing the call, and
49  * calls Tsyscall() on it.
50  */
51
52 void Tsyscall(const char *string);
53
54 void Qgettimeofday(void);
55 void Qselect(int n, fd_set rfds, fd_set wfds, fd_set efds, const struct timeval *t);
56
57 void Qsocket(int type);
58 void Qfcntl(int fd, int cmd, long arg);
59 void Qconnect(int fd, struct sockaddr *addr, int addrlen);
60 void Qclose(int fd);
61
62 void Qsendto(int fd, const void *msg, int msglen, unsigned int flags,
63              const struct sockaddr *addr, int addrlen);
64 void Qrecvfrom(int fd, int buflen, unsigned int flags, int *addrlen);
65
66 void Qread(int fd, size_t len);
67 void Qwrite(int fd, const void *buf, size_t len);
68
69 #endif