/
main.h
84 lines (72 loc) · 2.17 KB
/
main.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Soft: Perform a GET query to a remote HTTP/HTTPS server.
* Set a timer to compute global remote server response
* time.
*
* Part: main.c include file.
*
* Version: $Id: main.h,v 1.0.0 2002/11/20 21:34:18 acassen Exp $
*
* Authors: Alexandre Cassen, <acassen@linux-vs.org>
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Copyright (C) 2001, 2002, 2003 Alexandre Cassen, <acassen@linux-vs.org>
*/
#ifndef _MAIN_H
#define _MAIN_H
/* global includes */
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <popt.h>
#include <openssl/ssl.h>
/* local includes */
#include "memory.h"
#include "timer.h"
#include "http.h"
#include "ssl.h"
#include "list.h"
/* Build version */
#define PROG "genhash"
#define VERSION_CODE 0x010000
#define DATE_CODE 0x120b02
#define GETMETER_VERSION(version) \
(version >> 16) & 0xFF, \
(version >> 8) & 0xFF, \
version & 0xFF
#define VERSION_STRING PROG" v%d.%d.%d (%.2d/%.2d, 20%.2d)\n", \
GETMETER_VERSION(VERSION_CODE), \
GETMETER_VERSION(DATE_CODE)
/* HTTP/HTTPS request structure */
typedef struct {
uint32_t addr_ip;
uint16_t addr_port;
char *url;
char *vhost;
int verbose;
int ssl;
SSL_CTX *ctx;
SSL_METHOD *meth;
unsigned long ref_time;
unsigned long response_time;
} REQ;
/* Global variables */
REQ *req; /* Cmd line arguments */
unsigned int debug;
/* Data buffer length description */
#define BUFSIZE 1024
/* Command line error handling */
#define CMD_LINE_ERROR 0
#define CMD_LINE_SUCCESS 1
#endif