/* IPC header file for both TCP sockets and QNX message passing.
   Rick Smereka, Copyright (C) 1998-2006.

   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.

   You should have received a copy of the GNU General Public License
   along with this program; if not, get a copy via the Internet at
   http://gnu.org/copyleft/gpl.html or write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
   MA 02111-1307 USA

   You can contact the author via email at rsmereka@future-lab.com

   Original 32bit Windows version Dec/98, Rick Smereka

   Added platform specific includes and defines.
   Ported to HP-UX under GNU C 2.8.1.
   Jan/99, Rick Smereka

   Ported to Red Hat Linux 5.2, Jul/99, Rick Smereka

   Added define of 'arpa/inet.h' for Unix compiles.
   Aug/99, Rick Smereka

   Added 'SOCKET_SEND_STATUS' so that to query the status of any
   socket server has the same command number. Also added
   'SOCKET_SEND_TERM' so that all socket servers will respond
   to the same termination request code. These are currently
   used by the socket locate server (socloc). Oct/99,
   Rick Smereka

   Added 'SOCKET_SEND_LOG_OFF' and 'SOCKET_SEND_LOG_ON' so
   that all socket servers will respond to the same log
   request codes. Dec/99, Rick Smereka

   Added 'SOCKET_SEND_SERVICE_NAME' so that each server can
   return a service name identifying itself. Jan/2000,
   Rick Smereka

   Added 'SOCKET_SEND_VERSION' so that each server can
   return a version ID. Feb/2000, Rick Smereka

   Removed all common socket send and reply codes and moved
   them to the include file 'comcode.h'. Apr/2000, Rick
   Smereka

   Modified to support both TCP sockets and QNX message passing.
   Sep/2001, Rick Smereka

   Ported to Debian Linux. Nov/2002, Rick Smereka

   Changed scope of 'IPC_SEND_RETRY' from QNX only to all
   IPC's. Changed 'QUEUE_SIZE' to 1024 and added definition
   of 'SA' for Unix only. Apr/2003, Rick Smereka

   Added 'IPC_HEAD_SIZE' for TCP communication.
   Feb/2006, Rick Smereka */

/* TCP socket specific */

#ifdef IPC_TCP
#ifdef OS_WIN32
#include <winsock.h>

#define WINSOCK_VERSION 0x0101   // program requires Winsock V1.1
#endif

#ifdef OS_UNIX
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>

#define INVALID_SOCKET (-1)
#define SOCKET_ERROR (-1)
#define	SA struct sockaddr
#endif

#define IPC_SR_BUFSIZE 1024         // size of single send/receive buffer
#define QUEUE_SIZE 1024             // number of requests to allow in queue
#define DEFAULT_PROTOCOL 0          // use default protocol
#define NO_FLAGS 0                  // no send or receive flags
#define IPC_HEAD_SIZE 10            // size/length of TCP header
#endif

/* both TCP sockets and QNX message passing */

#define IPC_MAXREC 100000           // maximum size of send or receive data
#define IPC_SEND_RETRY 4            // number of send retries
