1 // =====================================================================
2 //
3 // file_io.h
4 //
5 // Author: Dave Freese, W1HKJ
6 // Copyright: 2010
7 //
8 // This file is part of FLAMP.
9 //
10 // This is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // This software is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 //
23 // =====================================================================
24 
25 #ifndef FILE_IO_H
26 #define FILE_IO_H
27 
28 #include <string.h>
29 #include <string>
30 #include <sys/time.h>
31 
32 #include "socket.h"
33 
34 
35 #ifdef WIN32
36 #  include <winsock2.h>
37 #else
38 #  include <arpa/inet.h>
39 #endif
40 
41 //using namespace std;
42 
43 enum {NONE, BASE64, BASE128, BASE256};
44 
45 extern Address *localaddr;
46 extern bool bConnected;
47 extern Socket *tcpip;
48 
49 extern struct timeval start_time;
50 extern int transfer_minutes;
51 
52 extern void compress_maybe(std::string& input, int encode_with, bool try_compress = true);
53 extern void connect_to_fldigi(void *);
54 extern void decompress_maybe(std::string& input);
55 extern void transfer(std::string tosend);
56 
57 extern int  rx_fldigi(char *buffer, int limit);
58 extern int  rx_fldigi(std::string &);
59 extern void rx_extract_reset();
60 
61 extern bool binary(std::string &);
62 extern bool c_binary(int c);
63 extern bool isPlainText(char *_buffer, size_t count);
64 extern bool isPlainText(std::string &_buffer);
65 
66 #endif
67