Debian Codegraph @

runtime/tcpclt.h

raw
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-2026 Adiscon GmbH.
8 *
9 * This file is part of rsyslog.
10 *
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
14 *
15 * http://www.apache.org/licenses/LICENSE-2.0
16 * -or-
17 * see COPYING.ASL20 in the source distribution
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 */
25 #ifndef TCPCLT_H_INCLUDED
26 #define TCPCLT_H_INCLUDED 1
27
28 #include "obj.h"
29
30 /* the tcpclt object */
31 typedef struct tcpclt_s {
32 BEGINobjInstance
33 ; /**< Data to implement generic object - MUST be the first data element! */
34 TCPFRAMINGMODE tcp_framing;
35 uchar tcp_framingDelimiter;
36 char *prevMsg;
37 short bResendLastOnRecon; /* should the last message be resent on a successful reconnect? */
38 size_t lenPrevMsg;
39 /* session specific callbacks */
40 int iNumMsgs; /* number of messages during current "rebind session" */
41 rsRetVal (*initFunc)(void *);
42 rsRetVal (*sendFunc)(void *, char *, size_t);
43 rsRetVal (*prepRetryFunc)(void *);
44 } tcpclt_t;
45
46
47 /* interfaces */
48 BEGINinterface(tcpclt) /* name must also be changed in ENDinterface macro! */
49 rsRetVal (*Construct)(tcpclt_t **ppThis);
50 rsRetVal (*ConstructFinalize)(tcpclt_t __attribute__((unused)) * pThis);
51 rsRetVal (*Destruct)(tcpclt_t **ppThis);
52 int (*Send)(tcpclt_t *pThis, void *pData, char *msg, size_t len);
53 int (*CreateSocket)(struct addrinfo *addrDest);
54 /* set methods */
55 rsRetVal (*SetResendLastOnRecon)(tcpclt_t *, int);
56 rsRetVal (*SetSendInit)(tcpclt_t *, rsRetVal (*)(void *));
57 rsRetVal (*SetSendFrame)(tcpclt_t *, rsRetVal (*)(void *, char *, size_t));
58 rsRetVal (*SetSendPrepRetry)(tcpclt_t *, rsRetVal (*)(void *));
59 rsRetVal (*SetFraming)(tcpclt_t *, TCPFRAMINGMODE framing);
60 /* v4, 2017-06-10*/
61 rsRetVal (*SetFramingDelimiter)(tcpclt_t *, uchar tcp_framingDelimiter);
62 ENDinterface(tcpclt)
63 #define tcpcltCURR_IF_VERSION 5 /* increment whenever you change the interface structure! */
64
65
66 /* prototypes */
67 PROTOTYPEObjFull(tcpclt);
68
69 /* the name of our library binary */
70 #define LM_TCPCLT_FILENAME "lmtcpclt"
71
72 #endif /* #ifndef TCPCLT_H_INCLUDED */