| /* |
| * Copyright 2015-2017 Rivoreo |
| * |
| * This program is free software; you can redistribute it and/or modify it |
| * under the terms of the GNU General Public License as published by the |
| * Free Software Foundation, either version 2 of the License, or (at your |
| * option) any later version. |
| * |
| * This program is distributed in the hope that 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. |
| */ |
| |
| #ifndef _RPF_COMMON_H |
| #define _RPF_COMMON_H |
| |
| #include <stdint.h> |
| #include <sys/time.h> |
| //#include <sys/socket.h> |
| #include <netinet/in.h> |
| |
| #define RIVOREO_COPYRIGHT_NOTICE "Copyright 2015-2017 Rivoreo" |
| #define LICENSE_INFORMATION "This is free software; see the source for copying conditions.\nThere is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\nPARTICULAR PURPOSE." |
| |
| #define MAGIC "RPF_" |
| #define KEEP_ALIVE 1 |
| #define NEW_CONNECTION 2 |
| struct new_connection_packet { |
| uint32_t len; |
| //struct timeval tv; |
| //struct sockaddr_storage addr; |
| struct in_addr address; |
| uint16_t port; |
| } __attribute__((__packed__)); |
| #define INITIAL_NEW_CONN_PACKET_LENGTH (4+4+2) |
| #define KEEP_ALIVE_REPLY 3 |
| |
| #ifndef MAX |
| #define MAX(A,B) ((A)>(B)?(A):(B)) |
| #endif |
| #ifndef MIN |
| #define MIN(A,B) ((A)<(B)?(A):(B)) |
| #endif |
| |
| #endif |