#ifndef COMM_H
#define COMM_H
#include <sys/types.h>
#ifdef atarist
#include "hosts/atari/socket.h"
#define SOCKET_INC "hosts/atari/socket.c"
#endif /* atarist */
#ifdef AMIGA
#include "hosts/amiga/socket.h"
#define SOCKET_INC "comm.h"
#define SOCKET_LIB "hosts/amiga/socket.h"
#endif /* AMIGA */
#if !defined (SOCKET_LIB) && !defined(SOCKET_INC)
#include <sys/socket.h>
#ifdef _AIX
#include <sys/socketvar.h>
#endif
#include <netinet/in.h>
#include <arpa/inet.h>
#endif /* SOCKET_LIB */
#ifdef MSDOS
#define SOCKET_INC "msdos/pcomm.h"
#endif
#include "interpret.h"
#if !defined (SOCKET_LIB) && !defined(SOCKET_INC)
#define SOCKET_T int
#define socket_number(s) (s)
#define socket_ioctl ioctl
#define socket_select select
#define socket_read read
#define socket_write write
#define socket_close close
#define SOCKET_INC "comm.h"
#endif /* SOCKET_LIB */
#if defined(SunOS4) || defined(atarist)
SOCKET_T socket PROT((int, int, int));
int getpeername PROT((SOCKET_T, struct sockaddr *, int *));
void shutdown PROT((SOCKET_T, int));
int setsockopt PROT((SOCKET_T, int, int, char *, int));
int bind PROT((SOCKET_T, struct sockaddr *, int));
int listen PROT((SOCKET_T, int));
SOCKET_T accept PROT((SOCKET_T, struct sockaddr *, int *));
struct timeval;
int select PROT((int, fd_set *, fd_set *, fd_set *, struct timeval *));
#endif /* SunOS4 */
#define MAX_TEXT 2048
#ifndef MAX_SOCKET_PACKET_SIZE
#define MAX_SOCKET_PACKET_SIZE 1024 /* Wild guess. */
#endif
#define DESIRED_SOCKET_PACKET_SIZE 800
#define MESSAGE_FLUSH ((char*)NULL)
struct interactive {
SOCKET_T socket;
struct object *ob; /* Points to the associated object */
struct input_to *input_to; /* To be called with next input line ! */
struct svalue prompt;
struct object *modify_command;
struct sockaddr_in addr;
char closing; /* True when closing this socket. */
char do_close; /* This is to be closed down. */
char noecho; /* Don't echo lines */
char catch_tell_activ;
int text_end; /* first free char in buffer */
int text_start; /* where we are up to in player cmd buffer */
struct interactive *snoop_on;
struct object *snoop_by;
int last_time; /* Time of last command executed */
char *default_err_message; /* This or What ? is printed when error */
int trace_level; /* Debug flags. 0 means no debugging */
char *trace_prefix; /* Trace only object which has this as name prefix */
struct ed_buffer *ed_buffer; /* Local ed */
int message_length;
struct object *next_player_for_flush, *previous_player_for_flush;
#ifdef PORTALS
int from_portal; /* True if this player has arrived through a portal */
int portal_socket; /* All messages should go through this socket, if open */
int out_portal; /* True if going out through a portal. */
#endif /* PORTALS */
#ifdef ACCESS_RESTRICTED
void *access_class; /* represents a "cluster" where this player comes from */
#endif
#ifdef MUDWHO
int login_time;
#endif
char text[MAX_TEXT];
char message_buf[DESIRED_SOCKET_PACKET_SIZE+1];
};
void set_prompt PROT((char *));
struct svalue *query_prompt PROT((struct object *));
#endif /* COMM_H */