File: libirc_dcc.h

package info (click to toggle)
libircclient 1.3%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 2,492 kB
  • ctags: 691
  • sloc: ansic: 2,706; cpp: 313; makefile: 132; sh: 120
file content (58 lines) | stat: -rw-r--r-- 1,684 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
/* 
 * Copyright (C) 2004-2009 Georgy Yunaev gyunaev@ulduzsoft.com
 *
 * This library is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU Lesser General Public License as published by 
 * the Free Software Foundation; either version 2 of the License, or (at your 
 * option) any later version.
 *
 * This library 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 Lesser General Public 
 * License for more details.
 */

#ifndef INCLUDE_IRC_DCC_H
#define INCLUDE_IRC_DCC_H

#ifndef IN_INCLUDE_LIBIRC_H
	#error This file should not be included directly, include just libirclient.h
#endif


/*
 * This structure keeps the state of a single DCC connection.
 */
struct irc_dcc_session_s
{
	irc_dcc_session_t	*	next;

	irc_dcc_t		id;
	void		*	ctx;
	socket_t		sock;		/*!< DCC socket */
	int				dccmode;	/*!< Boolean value to differ chat vs send 
	                             requests. Changes the cb behavior - when
	                             it is chat, data is sent by lines with 
	                             stripped CRLFs. In file mode, the data
	                             is sent as-is */
	int				state;
	time_t			timeout;

	FILE		*	dccsend_file_fp;
	unsigned int	received_file_size;
	unsigned int	file_confirm_offset;

	struct sockaddr_in	remote_addr;

	char 			incoming_buf[LIBIRC_DCC_BUFFER_SIZE];
	unsigned int	incoming_offset;

	char 			outgoing_buf[LIBIRC_DCC_BUFFER_SIZE];
	unsigned int	outgoing_offset;
	port_mutex_t	mutex_outbuf;

	irc_dcc_callback_t		cb;
};


#endif /* INCLUDE_IRC_DCC_H */