forked from mignon-p/https-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
https-common.h
43 lines (34 loc) · 1.19 KB
/
https-common.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
/* (c) Oblong Industries */
#ifndef COMMON_MAN
#define COMMON_MAN
/**
* Rather than using the standard https port of 443, use this one.
*/
#define COMMON_HTTPS_PORT 8421
/**
* This is the string the client tells the server in the POST request.
*/
#define COMMON_PASSCODE "R23"
/**
* If an OpenSSL function returns a return value indicating failure
* (for non-pointery functions, generally 1 means success, and non-1
* means failure), then usually it ought to have left one or more
* entries in the OpenSSL "error stack", which is a bit of thread-local
* state containing error information.
*
* This function is a simple way to handle OpenSSL errors (something
* better may be needed in a real application), which prints the
* name of the function which failed (which you must supply as an
* argument), prints the OpenSSL error stack (which hopefully says
* something meaningful) and exits.
*/
void die_most_horribly_from_openssl_error (const char *func);
void error_exit (const char *fmt, ...);
#define error_report printf
#define info_report printf
/**
* Calls some OpenSSL setup functions, which both the client and
* server need to do.
*/
void common_setup (void);
#endif /* COMMON_MAN */