2 * Copyright (C) 2017 Andy Spencer <andy753421@gmail.com>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 /* Networking Constants */
19 #define NET_BUFFER 1024
21 /* Networking Callbacks */
22 typedef void (*send_t)(void *data);
23 typedef void (*recv_t)(void *data, char *buf, int len);
24 typedef void (*err_t)(void *data, int errno);
26 /* Networking Types */
27 typedef struct crypto_t crypto_t;
54 char out_buf[NET_BUFFER];
59 /* Networking functions */
60 const char *get_hostname(void);
62 /* Connection functions */
64 void net_open(net_t *net, const char *host, int port);
65 void net_encrypt(net_t *net, int flags);
66 int net_send(net_t *net, const char *buf, int len);
67 int net_print(net_t *net, const char *fmt, ...);
68 void net_close(net_t *net);