-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathmain.c
41 lines (37 loc) · 936 Bytes
/
main.c
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
/*
* main.c
* OpenSSL
*
* Created by Thirumal Venkat on 18/05/16.
* Copyright © 2016 Thirumal Venkat. All rights reserved.
*/
#include <stdio.h>
#include <string.h>
#include "client.h"
#include "server.h"
/*
* Print the usage of the current command line tool
*/
void usage(const char * argv[]) {
fprintf(stderr, "Usage: %s "
/* 2 */ "(server <port_num> | client <server_ip>:<server_port>) "
/* 3 */ "<CAfile_pem> "
/* 4 */ "<cert_pem> "
/* 5 */ "<key_pem>\n", argv[0]);
}
/*
* Main routine
*/
int main(int argc, const char * argv[]) {
if (argc != 6) {
usage(argv);
return -1;
} else if (!strcmp(argv[1], "server")) {
return server(argv[2], argv[3], argv[4], argv[5]);
} else if (!strcmp(argv[1], "client")) {
return client(argv[2], argv[3], argv[4], argv[5]);
} else {
usage(argv);
return -1;
}
}