OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / user / rsyslog / tcpclt.h
1 /* tcpclt.h
2  *
3  * This are the definitions for the TCP based clients class.
4  *
5  * File begun on 2007-07-21 by RGerhards (extracted from syslogd.c)
6  *
7  * Copyright 2007, 2008 Rainer Gerhards and Adiscon GmbH.
8  *
9  * This file is part of rsyslog.
10  *
11  * Rsyslog is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * Rsyslog is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with Rsyslog.  If not, see <http://www.gnu.org/licenses/>.
23  *
24  * A copy of the GPL can be found in the file "COPYING" in this distribution.
25  */
26 #ifndef TCPCLT_H_INCLUDED
27 #define TCPCLT_H_INCLUDED 1
28
29 #include "tcpsyslog.h"
30 #include "obj.h"
31
32 /* the tcpclt object */
33 typedef struct tcpclt_s {
34         BEGINobjInstance;       /**< Data to implement generic object - MUST be the first data element! */
35         TCPFRAMINGMODE tcp_framing;
36         char *prevMsg;
37         size_t lenPrevMsg;
38         /* session specific callbacks */
39         rsRetVal (*initFunc)(void*);
40         rsRetVal (*sendFunc)(void*, char*, size_t);
41         rsRetVal (*prepRetryFunc)(void*);
42 } tcpclt_t;
43
44
45 /* interfaces */
46 BEGINinterface(tcpclt) /* name must also be changed in ENDinterface macro! */
47         rsRetVal (*Construct)(tcpclt_t **ppThis);
48         rsRetVal (*ConstructFinalize)(tcpclt_t __attribute__((unused)) *pThis);
49         rsRetVal (*Destruct)(tcpclt_t **ppThis);
50         int (*Send)(tcpclt_t *pThis, void*pData, char*msg, size_t len);
51         int (*CreateSocket)(struct addrinfo *addrDest);
52         /* set methods */
53         rsRetVal (*SetSendInit)(tcpclt_t*, rsRetVal (*)(void*));
54         rsRetVal (*SetSendFrame)(tcpclt_t*, rsRetVal (*)(void*, char*, size_t));
55         rsRetVal (*SetSendPrepRetry)(tcpclt_t*, rsRetVal (*)(void*));
56         rsRetVal (*SetFraming)(tcpclt_t*, TCPFRAMINGMODE framing);
57 ENDinterface(tcpclt)
58 #define tcpcltCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */
59
60
61 /* prototypes */
62 PROTOTYPEObj(tcpclt);
63
64 /* the name of our library binary */
65 #define LM_TCPCLT_FILENAME "lmtcpclt"
66
67 #endif /* #ifndef TCPCLT_H_INCLUDED */
68 /* vim:set ai:
69  */