A couple more filters for guile features.
[tlb/tomd.git] / src / common / protocol.c
1 /* Copyright (C) 2018 Thomas Balzer */
2
3 /* This file is part of tomd. */
4
5 /* tomd is free software: you can redistribute it and/or modify */
6 /* it under the terms of the GNU General Public License as published by */
7 /* the Free Software Foundation, either version 3 of the License, or */
8 /* (at your option) any later version. */
9
10 /* tomd is distributed in the hope that it will be useful, */
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
13 /* GNU General Public License for more details. */
14
15 /* You should have received a copy of the GNU General Public License */
16 /* along with tomd. If not, see <http://www.gnu.org/licenses/>. */
17
18 /* Commentary: */
19 /* This file contains functions to be used by both client and server */
20 /* communicate between the two */
21
22 static int sfd;
23
24 int send_to_server(char *buffer, size_t len)
25 {
26 if(buffer == NULL){
27 printf("buffer cannot be null\n");
28 return -1;
29 }
30
31 if(len == 0){
32 return 0;
33 }
34
35 if(sfd < 0){
36 printf("server connection lost.\n");
37 return -1;
38 }
39
40 }