2 Copyright 2019 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP. If not, see <https://www.gnu.org/licenses/>.
23 #include <sys/socket.h>
24 #include <sys/select.h>
29 #define MAXBUFLEN 2000
36 bool init(USHORT port);
38 unsigned char waitforMessage(unsigned char); // int =0-block =1-new wait =2-continue wait
39 void send(const char *, USHORT, char *, int); // send wants: IP Address ddn style, port,
40 // data, length of data
42 char* getData() { return buf; } // returns a pointer to the data
43 char* getFromIPA() { return fromIPA; } // returns a pointer to from IP address
44 USHORT getFromPort() const { return fromPort; } // returns the sender port number
45 int getDataLength() const { return mlength; } // returns data length
50 int socketnum; // Socket descriptor
52 socklen_t addrlen; // length of sockaddr struct
53 char buf[MAXBUFLEN]; // main data buffer
54 char fromIPA[40]; // from string (ip address)
55 USHORT fromPort; // which port user sent on
56 int mlength; // length of message