chiark / gitweb /
1f96131de216c06eacbf19eabad2f9c5787cef36
[adns.git] / regress / harness.h.m4
1 m4_dnl harness.h.m4
2 m4_dnl (part of complex test harness, not of the library)
3 m4_dnl - function and other declarations
4
5 m4_dnl  This file is
6 m4_dnl    Copyright (C) 1997-1999 Ian Jackson <ian@davenant.greenend.org.uk>
7 m4_dnl
8 m4_dnl  It is part of adns, which is
9 m4_dnl    Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
10 m4_dnl    Copyright (C) 1999 Tony Finch <dot@dotat.at>
11 m4_dnl  
12 m4_dnl  This program is free software; you can redistribute it and/or modify
13 m4_dnl  it under the terms of the GNU General Public License as published by
14 m4_dnl  the Free Software Foundation; either version 2, or (at your option)
15 m4_dnl  any later version.
16 m4_dnl  
17 m4_dnl  This program is distributed in the hope that it will be useful,
18 m4_dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
19 m4_dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 m4_dnl  GNU General Public License for more details.
21 m4_dnl  
22 m4_dnl  You should have received a copy of the GNU General Public License
23 m4_dnl  along with this program; if not, write to the Free Software Foundation,
24 m4_dnl  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
25
26 m4_include(hmacros.i4)
27
28 #ifndef HARNESS_H_INCLUDED
29 #define HARNESS_H_INCLUDED
30
31 #include <sys/time.h>
32 #include <sys/socket.h>
33 #include <sys/uio.h>
34 #include <unistd.h>
35
36 #include "internal.h"
37
38 #ifdef HAVE_POLL
39 #include <sys/poll.h>
40 #endif
41
42 /* We override several system calls with #define's */
43
44 hm_create_proto_h
45 m4_define(`hm_syscall', `int H$1(hm_args_massage($3,void));')
46 m4_include(`hsyscalls.i4')
47
48 int Hwritev(int fd, const struct iovec *vector, size_t count);
49 int Hgettimeofday(struct timeval *tv, struct timezone *tz);
50
51 void *Hmalloc(size_t sz);
52 void Hfree(void *ptr);
53 void *Hrealloc(void *op, size_t nsz);
54 void Hexit(int rv);
55
56 /* There is a Q function (Q for Question) for each such syscall;
57  * it constructs a string representing the call, and calls Q_str
58  * on it, or constructs it in vb and calls Q_vb;
59  */
60
61 hm_create_proto_q
62 m4_define(`hm_syscall', `void Q$1(hm_args_massage($3,void));')
63 m4_include(`hsyscalls.i4')
64
65 void Q_vb(void);
66
67 extern void Tshutdown(void);
68
69 /* General help functions */
70
71 void Tfailed(const char *why);
72 void Toutputerr(void);
73 void Tnomem(void);
74 void Tfsyscallr(const char *fmt, ...) PRINTFFORMAT(1,2);
75 void Tensureoutputfile(void);
76 void Tmust(const char *call, const char *arg, int cond);
77
78 void Tvbf(const char *fmt, ...) PRINTFFORMAT(1,2);
79 void Tvbvf(const char *fmt, va_list al);
80 void Tvbfdset(int max, const fd_set *set);
81 void Tvbpollfds(const struct pollfd *fds, int nfds);
82 void Tvbaddr(const struct sockaddr *addr, int addrlen);
83 void Tvbbytes(const void *buf, int len);
84 void Tvberrno(int e);
85 void Tvba(const char *str);
86
87 /* Shared globals */
88
89 extern vbuf vb;
90 extern struct timeval currenttime;
91 extern const struct Terrno { const char *n; int v; } Terrnos[];
92   
93 #endif