blob: 9aaf067eb3aa007de9cdf1b2fe2c97574cc836de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/* network.h
*
*/
/*
fics - An internet chess server.
Copyright (C) 1993 Richard V. Nash
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.
*/
/* Revision history:
name email yy/mm/dd Change
Richard Nash 93/10/22 Created
Markus Uhlin 23/12/13 Cleaned up the file
*/
#ifndef _NETWORK_H
#define _NETWORK_H
#include "command.h" /* For MAX_STRING_LENGTH */
#define NET_NETERROR 0
#define NET_NEW 1
#define NET_DISCONNECT 2
#define NET_READLINE 3
#define NET_TIMEOUT 4
#define NET_NOTCOMPLETE 5
#define LINE_WIDTH 80
#ifndef O_NONBLOCK
#define O_NONBLOCK 00004
#endif
#define NETSTAT_EMPTY 0
#define NETSTAT_CONNECTED 1
#define NETSTAT_IDENT 2
typedef struct _connection {
int fd;
int outFd;
int status;
unsigned int fromHost;
#ifdef TIMESEAL
char sys[512];
char user[512];
int time;
int timeseal;
#endif
/* Input buffering */
int numPending;
int processed;
unsigned char inBuf[MAX_STRING_LENGTH];
/* Output buffering */
char *sndbuf; /* our send buffer, or NULL if none yet */
int outPos; /* column count */
int sndbufpos; /* position in send buffer */
int sndbufsize; /* size of send buffer (this changes) */
int state; /* 'telnet state' */
/* identd stuff */
char ident[20];
int mypal;
} connection;
extern connection con[512];
extern int no_file;
extern int max_connections;
extern int findConnection(int);
extern int net_addConnection(int, unsigned int);
extern int net_consize(void);
extern int net_init(int);
extern int net_send_string(int, char *, int);
extern int readline2(char *, int);
extern unsigned int
net_connected_host(int);
extern void net_close(void);
extern void net_close_connection(int);
extern void ngc2(char *, int);
extern void turn_echo_off(int);
extern void turn_echo_on(int);
#endif /* _NETWORK_H */
|