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
|
/*
* Copyright (C) 2016 Intel Corporation
*
* Author: Todor Minchev <todor.minchev@linux.intel.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, or (at your option) any later version, as published by
* the Free Software Foundation.
*
* This program is distributed in the hope 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.
*/
#include <stdlib.h>
#include "globals.h"
#include "ceed_api.h"
#include "utils.h"
extern char *ceed_ops[];
int main(int argc, char *argv[]) {
int i, done, sock_fd;
char *turff_nodes[KEY_ARR_SZ];
struct addrinfo *addr_p;
void *ceed_out;
parse_ceed_params(argc, argv);
addr_p = connect_to_socket(ceed_ops[KEY('i')], ceed_ops[KEY('s')], &sock_fd);
if(addr_p == NULL) {
ERR("Could not connect to CODI\n");
} else {
INFO("Connected to CODI on %s port : %s\n",
ceed_ops[KEY('i')], ceed_ops[KEY('s')]);
}
INFO("Host Architecture : %s\n", ceed_ops[KEY('a')]);
send_args(sock_fd, ceed_ops);
if(ceed_ops[KEY('l')] == NULL) { /* this was a service request */
INFO(" ========== CEED OUTPUT BEGIN ==========\n");
ceed_out = calloc(1, BUFSIZ);
done = 0;
while(!done) {
memset(ceed_out, 0, BUFSIZ);
receive_data(sock_fd, ceed_out, BUFSIZ, 1, &done);
}
free(ceed_out);
INFO(" ========== CEED OUTPUT END ==========\n");
} else { /* this was nodes request, receive turff nodes */
do {
for(i = 0; i < KEY_ARR_SZ; i++)
turff_nodes[i] = NULL;
receive_args(sock_fd, turff_nodes);
if(turff_nodes[KEY('e')] == NULL) {
INFO("TURFF Node ID: %s \n", turff_nodes[KEY('d')]);
}
}while (turff_nodes[KEY('e')] == NULL);
}
close(sock_fd);
return 0;
}
|