Test harness - recording seems to work, sort of.
[adns] / src / harness.h
CommitLineData
a4f094dd 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>
7d251914 27#include <sys/socket.h>
a4f094dd 28#include <unistd.h>
29
7d251914 30#include "internal.h"
31
a4f094dd 32/* We override several system calls with #define's */
33
34int Hgettimeofday(struct timeval *tv, struct timezone *tz);
7d251914 35int Hselect(int n, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *to);
a4f094dd 36
37int Hsocket(int domain, int type, int protocol);
7d251914 38int Hfcntl(int fd, int cmd, ...);
a4f094dd 39int Hconnect(int fd, struct sockaddr *addr, int addrlen);
40int Hclose(int fd);
41
42int Hsendto(int fd, const void *msg, int msglen, unsigned int flags,
43 const struct sockaddr *addr, int addrlen);
44int Hrecvfrom(int fd, void *buf, int buflen, unsigned int flags,
45 struct sockaddr *addr, int *addrlen);
46
47int Hread(int fd, void *buf, size_t len);
48int Hwrite(int fd, const void *buf, size_t len);
49
50/* There is a Q function (Q for Question) for each such syscall;
7d251914 51 * it constructs a string representing the call, and calls Q_str
52 * on it, or constructs it in vb and calls Q_vb;
a4f094dd 53 */
54
a4f094dd 55void Qgettimeofday(void);
7d251914 56void Qselect(int n, const fd_set *rfds, const fd_set *wfds, const fd_set *efds,
57 const struct timeval *to);
a4f094dd 58
59void Qsocket(int type);
7d251914 60void Qfcntl_setfl(int fd, int cmd, long arg);
61void Qfcntl_other(int fd, int cmd);
a4f094dd 62void Qconnect(int fd, struct sockaddr *addr, int addrlen);
63void Qclose(int fd);
64
7d251914 65void Qsendto(int fd, const void *msg, int msglen,
a4f094dd 66 const struct sockaddr *addr, int addrlen);
7d251914 67void Qrecvfrom(int fd, int buflen, int addrlen);
a4f094dd 68
69void Qread(int fd, size_t len);
70void Qwrite(int fd, const void *buf, size_t len);
71
7d251914 72void Q_str(const char *str);
73void Q_vb(void);
74
75/* General help functions */
76
77void Tfailed(const char *why);
78void Toutputerr(void);
79void Tnomem(void);
80void Tfsyscallr(const char *fmt, ...) PRINTFFORMAT(1,2);
81void Tensureoutputfile(void);
82
83void Tvbf(const char *fmt, ...) PRINTFFORMAT(1,2);
84void Tvbvf(const char *fmt, va_list al);
85void Tvbfdset(int max, const fd_set *set);
86void Tvbaddr(const struct sockaddr *addr, int addrlen);
87void Tvbbytes(const void *buf, int len);
88void Tvberrno(int e);
89void Tvba(const char *str);
90
91/* Shared globals */
92
93extern vbuf vb;
94extern FILE *Toutputfile;
95
96extern const struct Terrno { const char *n; int v; } Terrnos[];
97
a4f094dd 98#endif