]> git.ipfire.org Git - thirdparty/lldpd.git/blame - tests/common.h
tests: display tests/test-suite.log on errors
[thirdparty/lldpd.git] / tests / common.h
CommitLineData
eab6aa62
VB
1/* -*- mode: c; c-file-style: "openbsd" -*- */
2/*
3 * Copyright (c) 2015 Vincent Bernat <bernat@luffy.cx>
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
4dc61015
VB
18#ifndef _COMMON_H
19#define _COMMON_H
20
a0cd2b9a 21#include "check-compat.h"
4b292b55 22#include "../src/daemon/lldpd.h"
4dc61015
VB
23
24/* See:
25 * http://wiki.wireshark.org/Development/LibpcapFileFormat
26 */
27struct pcap_hdr {
28 u_int32_t magic_number; /* magic number */
29 u_int16_t version_major; /* major version number */
30 u_int16_t version_minor; /* minor version number */
31 u_int32_t thiszone; /* GMT to local correction */
32 u_int32_t sigfigs; /* accuracy of timestamps */
33 u_int32_t snaplen; /* max length of captured packets, in octets */
34 u_int32_t network; /* data link type */
35};
36struct pcaprec_hdr {
37 u_int32_t ts_sec; /* timestamp seconds */
38 u_int32_t ts_usec; /* timestamp microseconds */
39 u_int32_t incl_len; /* number of octets of packet saved in file */
40 u_int32_t orig_len; /* actual length of packet */
41};
42
43struct packet {
44 TAILQ_ENTRY(packet) next;
45 int size;
46 char data[];
47};
48TAILQ_HEAD(pkts_t, packet);
49
50extern int dump; /* Dump file descriptor in pcap format */
51extern char filenameprefix[]; /* Prefix for filename dumping */
52extern char *filename; /* Filename we are dumping to */
53extern char macaddress[]; /* MAC address we use to send */
dedb1eb0 54
4dc61015
VB
55extern struct pkts_t pkts; /* List of sent packets */
56extern struct lldpd_hardware hardware;
57extern struct lldpd_chassis chassis;
58
59int pcap_send(struct lldpd *, struct lldpd_hardware *, char *, size_t);
60void pcap_setup();
61void pcap_teardown();
62
63#endif