3 * - complex test harness function declarations, not part of the library
6 * This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson
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)
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.
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.
23 #ifndef HARNESS_H_INCLUDED
24 #define HARNESS_H_INCLUDED
27 #include <sys/socket.h>
32 /* We override several system calls with #define's */
34 int Hgettimeofday(struct timeval
*tv
, struct timezone
*tz
);
35 int Hselect(int n
, fd_set
*rfds
, fd_set
*wfds
, fd_set
*efds
, struct timeval
*to
);
37 int Hsocket(int domain
, int type
, int protocol
);
38 int Hfcntl(int fd
, int cmd
, ...);
39 int Hconnect(int fd
, struct sockaddr
*addr
, int addrlen
);
42 int Hsendto(int fd
, const void *msg
, int msglen
, unsigned int flags
,
43 const struct sockaddr
*addr
, int addrlen
);
44 int Hrecvfrom(int fd
, void *buf
, int buflen
, unsigned int flags
,
45 struct sockaddr
*addr
, int *addrlen
);
47 int Hread(int fd
, void *buf
, size_t len
);
48 int Hwrite(int fd
, const void *buf
, size_t len
);
50 /* There is a Q function (Q for Question) for each such syscall;
51 * it constructs a string representing the call, and calls Q_str
52 * on it, or constructs it in vb and calls Q_vb;
55 void Qgettimeofday(void);
56 void Qselect(int n
, const fd_set
*rfds
, const fd_set
*wfds
, const fd_set
*efds
,
57 const struct timeval
*to
);
59 void Qsocket(int type
);
60 void Qfcntl_setfl(int fd
, int cmd
, long arg
);
61 void Qfcntl_other(int fd
, int cmd
);
62 void Qconnect(int fd
, struct sockaddr
*addr
, int addrlen
);
65 void Qsendto(int fd
, const void *msg
, int msglen
,
66 const struct sockaddr
*addr
, int addrlen
);
67 void Qrecvfrom(int fd
, int buflen
, int addrlen
);
69 void Qread(int fd
, size_t len
);
70 void Qwrite(int fd
, const void *buf
, size_t len
);
72 void Q_str(const char *str
);
75 /* General help functions */
77 void Tfailed(const char *why
);
78 void Toutputerr(void);
80 void Tfsyscallr(const char *fmt
, ...) PRINTFFORMAT(1,2);
81 void Tensureoutputfile(void);
83 void Tvbf(const char *fmt
, ...) PRINTFFORMAT(1,2);
84 void Tvbvf(const char *fmt
, va_list al
);
85 void Tvbfdset(int max
, const fd_set
*set
);
86 void Tvbaddr(const struct sockaddr
*addr
, int addrlen
);
87 void Tvbbytes(const void *buf
, int len
);
89 void Tvba(const char *str
);
94 extern FILE *Toutputfile
;
96 extern const struct Terrno
{ const char *n
; int v
; } Terrnos
[];