/*  
    tcp.h
*/
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#define TRUSS    1        /* output for truss  */

extern int errno;
void   usage(),die_err(int);
int str_echo(int,pid_t ) ;
int readline(int ,char *, int );
int writen(int ,char *,int ) ;

#define ENV_PORT        "TEST_PORT"          /* setenv TEST_PORT 3333  */
#define ENV_HOST        "TEST_HOST"          /* setenv TEST_HOST ozzy */
#define SRV_PORT        3333
#define TCP_INSDIR      "/usr/local/bin/"
#define SRV_HOST_NAME   "ozzy"                /* ozzy:solaris */
/* not used    */
#define SRV_HOST_ADDR   "172.30.175.96"       /* ozzy:solaris */

#define SZ_ADDR         (sizeof(struct sockaddr_in))
#define MAX_LINE         512
#define SZ_QUEUE         5		/* QUEUE SIZE */

#define WAIT_TIME         30          /* wait interval   */
#define CLOSED            1           /* already closed   */

/* 
   command list
*/
#define DS_QUIT       "DS_Quit\n"    /* dedicated server quit */
#define DS_CLS_WQUIT  "DS_CW\n"      /* dedicated server socket colse & wait*/
#define C_QUIT        "C_Quit\n"     /* client quit */
#define C_CLOSE       "C_Close\n"    /* client socket close */
#define DS_C_QUIT     "DS_C_Quit\n"  /* dedicated sever and client quit */
#define CQUIT_SWQUIT  "CQ_DSW\n"     /* client quit  & server wait ?? sec & quit*/

int  port_no;
char *cp,*host_nm,*home;

int get_env() {
   cp = getenv(ENV_PORT);
   if (! cp)   port_no = SRV_PORT;
   else        port_no = atoi(cp);
   cp = getenv(ENV_HOST);
   if (! cp)   host_nm = SRV_HOST_NAME;
   else        host_nm = cp;
   cp = getenv("HOME");
   home = cp;
}

/*
    for truss
*/
#ifdef TRUSS
#define PRT_TRS(str)    printf(str)   
#else
#define PRT_TRS(str)
#endif