File: dcc.h

package info (click to toggle)
ircii-pana 75-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 4,448 kB
  • ctags: 7,556
  • sloc: ansic: 82,667; makefile: 989; tcl: 153; sh: 124
file content (158 lines) | stat: -rw-r--r-- 4,906 bytes parent folder | download
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
 * dcc.h: Things dealing client to client connections. 
 *
 * Copyright(c) 1998 Colten Edwards 
 *
 */

#ifndef __dcc_h_
#define __dcc_h_

	/* 
	 * these are all used in the bot_link layer. the dcc_printf is used in
	 * a few other places as well. ie dcc.c
	 */
	int	dcc_printf (int, char *, ...);
	void	tandout_but (int, char *, ...);
	void	chanout_but (int, char *, ...);
	int	handle_tcl_chan (int, char *, char *, char *);
	int	tand_chan (int, char *);
	int	tand_zapf (int, char *);
	int	tand_zapfbroad (int, char *);
	int	handle_dcc_bot (int, char *);
	int	tandem_join (int, char *);
	int	tandem_part (int, char *);
	int	send_who_to (int, char *, int);
	int	tand_who (int, char *);
	int	tand_whom (int, char *);
	int	tell_who (int, char *);
	int	send_who (int, char *);
	int	tell_whom (int, char *);
	int	send_whom (int, char *);
	int	tand_priv (int, char *);
	int	tand_boot (int, char *);
	int	tand_privmsg (int, char *);
	int	cmd_cmsg (int, char *);
	int	cmd_cboot (int, char *);
	int	cmd_act (int, char *);
	int	cmd_help (int, char *);
	int	cmd_msg (int, char *);
	int	cmd_say (int, char *);
	int	cmd_tcl (int, char *);
	int	cmd_chat (int, char *);
	int	cmd_quit (int, char *);
	int	cmd_invite (int, char *);
	int	cmd_echo (int, char *);
	int	dcc_ftpcommand (char *, char *);
	

/* 
 * these definitions are mostly used by ircII as well 
 * I expanded the flags to a full 32 bits to allow for future
 * expansion. 
 */
#define DCC_PACKETID  0xfeab		/* used to figure out endianess 
					 * as well as identify the resend
					 * packet 
					 */
#define MAX_DCC_BLOCK_SIZE 16384	/* 
					 * this is really arbritrary value.
					 * we can actually make this a lot
					 * larger and things will still work
					 * as expected. The network layer places
					 * a limit however. 
					 */

#define DCC_CHAT	0x00000001

#define DCC_FILEOFFER	0x00000002
#define DCC_FILEREAD	0x00000003

#define	DCC_RAW_LISTEN	0x00000004
#define	DCC_RAW		0x00000005

#define DCC_REFILEOFFER	0x00000006
#define DCC_REFILEREAD	0x00000007

#define DCC_BOTMODE	0x00000008
#define DCC_FTPOPEN	0x00000009
#define DCC_FTPGET	0x0000000a
#define DCC_FTPSEND	0x0000000b
#define DCC_TYPES	0x000000ff

#define DCC_WAIT	0x00010000
#define DCC_ACTIVE	0x00020000
#define DCC_OFFER	0x00040000
#define DCC_DELETE	0x00080000
#define DCC_TWOCLIENTS	0x00100000

#ifdef NON_BLOCKING_CONNECTS
#define DCC_CNCT_PEND	0x00200000
#endif

#define DCC_QUEUE	0x00400000
#define DCC_TDCC	0x00800000
#define DCC_BOTCHAT	0x01000000
#define DCC_ECHO	0x02000000
#define DCC_STATES	0xffffff00

typedef struct _dcc_internal {
	char		*user;			/* user being dcc'd */ 
	char		*userhost;		/* possible userhost */
	char		*encrypt;		/* password used */
	char		*filename;		/* filename without path or type*/
	char		*othername;		/* possible other info */
	u_32int_t	bytes_read;		/* number of bytes read */
	u_32int_t	bytes_sent;		/* number of bytes sent */
	struct timeval	starttime;		/* when did this dcc start */
	struct timeval	lasttime;		/* last time of activity */
	struct transfer_struct transfer_orders;	/* structure for resending files */
	int		file;			/* file handle open file */
	u_32int_t	filesize;		/* the filesize to get */
	unsigned long	packets;		/* number of blocksize packets recieved */
	int		eof;			/* in EOF condition. */
	int		blocksize;		/* this dcc's blocksize */
	int		dcc_fast;		/* set if non-blocking used */
	short		readwaiting; 		/* expect a data on the port */
	unsigned short	remport;		/* the remport we are connected to */
	unsigned short	localport;		/* the localport we are on */
	struct	in_addr	remote;			/* this dcc's remote address */
	unsigned int	dccnum;			/* dcc number we are at */
} DCC_int;

#define DCC_COMMAND(x) void x (char *command, char *args)

	int	check_dcc_list (char *);
	int	dcc_exempt_save (FILE *);
	
	DCC_COMMAND(dcc_filesend);
	DCC_COMMAND(dcc_resend);
	DCC_COMMAND(dcc_stats);
	DCC_COMMAND(dcc_chat);
	DCC_COMMAND(dcc_ftpopen);
	DCC_COMMAND(dcc_glist);
	DCC_COMMAND(dcc_chatbot);
	DCC_COMMAND(dcc_resume);

	int	get_active_count();
	int	dcc_ftpcommand(char *, char *);
	void	process_dcc(char *);
	int	dcc_activechat(char *);	/* identify all active chat dcc's */
	int	dcc_activebot(char *);	/* identify all active bot's */
	int	dcc_activeraw(char *);  /* identify all active raw connects */
	void	dcc_chat_transmit(char *, char *, char *, char *, int);
	void	dcc_bot_transmit(char *, char *, char *);
	void	dcc_raw_transmit(char *, char *, char *);

	void	register_dcc_type(char *, char *, char *, char *, char *, char *, char *, char *);

	void	dcc_reject(char *, char *, char *);
	char	*dcc_raw_connect(char *, unsigned short);
	char	*dcc_raw_listen(int port);
	void	close_all_dcc(void);
	void	dcc_sendfrom_queue(void);
	void	dcc_check_idle(void);
	int	check_dcc_socket(int);
	SocketList *find_dcc(char *, char *, int, int, int, int);	
	void	erase_dcc_info(int, int, char *, ...);
#endif /* __dcc_h_ */