/*
// ColdMUD was created and is copyright 1993, 1994 by Greg Hudson
//
// ColdX is a derivitive work, and is copyright 1995 by the ColdX Project.
// Full copyright information can be found in the file doc/CREDITS
//
// File: file.h
// Version: 0.1-5
// Last Edited: 30 Jul 1995
//
// ---
//
// Declarations for file control.
*/
#ifndef _file_h_
#define _file_h_
typedef struct file File;
#include "cmstring.h"
#include "data.h"
struct file {
int fd; /* File descriptor for input and output. */
Dbref dbref; /* Object file is associated with. */
struct {
char readable; /* Connection has new data pending. */
char writable; /* Connection can be written to. */
char dead; /* Connection is defunct. */
} flags;
Connection *next;
};
struct server {
int server_socket;
unsigned short port;
Dbref dbref;
int dead;
int client_socket;
char client_addr[20];
unsigned short client_port;
Server *next;
};
struct pending {
int fd;
long task_id;
Dbref dbref;
long error;
int finished;
Pending *next;
};
void flush_defunct(void);
void handle_new_and_pending_connections(void);
void handle_io_event_wait(int seconds);
void handle_connection_input(void);
void handle_connection_output(void);
void tell(long dbref, Buffer *buf);
int boot(long dbref);
int add_server(int port, long dbref);
int remove_server(int port);
long make_connection(char *addr, int port, Dbref receiver);
void flush_output(void);
#endif