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