~ubuntu-branches/ubuntu/karmic/rsyslog/karmic-200908151517

« back to all changes in this revision

Viewing changes to tcpsrv.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2008-04-23 16:46:39 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080423164639-5acmt8a4vpxjgnxw
Tags: 3.14.2-3
* debian/rsyslog-doc.install
  - Fix a typo in the install path of the dia files. Closes: #477489
    Thanks to Justin B Rye for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Definitions for tcpsrv class.
 
2
 *
 
3
 * Copyright 2008 Rainer Gerhards and Adiscon GmbH.
 
4
 *
 
5
 * This file is part of rsyslog.
 
6
 *
 
7
 * Rsyslog is free software: you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation, either version 3 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * Rsyslog is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with Rsyslog.  If not, see <http://www.gnu.org/licenses/>.
 
19
 *
 
20
 * A copy of the GPL can be found in the file "COPYING" in this distribution.
 
21
 */
 
22
#ifndef INCLUDED_TCPSRV_H
 
23
#define INCLUDED_TCPSRV_H
 
24
 
 
25
#include "obj.h"
 
26
#include "tcps_sess.h"
 
27
 
 
28
/* the tcpsrv object */
 
29
typedef struct tcpsrv_s {
 
30
        BEGINobjInstance;       /**< Data to implement generic object - MUST be the first data element! */
 
31
        int *pSocksLstn;        /**< listen socket array for server [0] holds count */
 
32
        int iSessMax;           /**< max number of sessions supported */
 
33
        char *TCPLstnPort;      /**< the port the listener shall listen on */
 
34
        tcps_sess_t **pSessions;/**< array of all of our sessions */
 
35
        void *pUsr;             /**< a user-settable pointer (provides extensibility for "derived classes")*/
 
36
        /* callbacks */
 
37
        int      (*pIsPermittedHost)(struct sockaddr *addr, char *fromHostFQDN, void*pUsrSrv, void*pUsrSess);
 
38
        int      (*pRcvData)(tcps_sess_t*, char*, size_t);
 
39
        int*     (*OpenLstnSocks)(struct tcpsrv_s*);
 
40
        rsRetVal (*pOnListenDeinit)(void*);
 
41
        rsRetVal (*OnDestruct)(void*);
 
42
        rsRetVal (*pOnRegularClose)(tcps_sess_t *pSess);
 
43
        rsRetVal (*pOnErrClose)(tcps_sess_t *pSess);
 
44
        /* session specific callbacks */
 
45
        rsRetVal (*pOnSessAccept)(struct tcpsrv_s *, tcps_sess_t*);
 
46
        rsRetVal (*OnSessConstructFinalize)(void*);
 
47
        rsRetVal (*pOnSessDestruct)(void*);
 
48
} tcpsrv_t;
 
49
 
 
50
 
 
51
/* interfaces */
 
52
BEGINinterface(tcpsrv) /* name must also be changed in ENDinterface macro! */
 
53
        INTERFACEObjDebugPrint(tcpsrv);
 
54
        rsRetVal (*Construct)(tcpsrv_t **ppThis);
 
55
        rsRetVal (*ConstructFinalize)(tcpsrv_t __attribute__((unused)) *pThis);
 
56
        rsRetVal (*Destruct)(tcpsrv_t **ppThis);
 
57
        void (*configureTCPListen)(tcpsrv_t*, char *cOptarg);
 
58
        int (*SessAccept)(tcpsrv_t *pThis, tcps_sess_t**ppSess, int fd);
 
59
        int* (*create_tcp_socket)(tcpsrv_t *pThis);
 
60
        rsRetVal (*Run)(tcpsrv_t *pThis);
 
61
        /* set methods */
 
62
        rsRetVal (*SetUsrP)(tcpsrv_t*, void*);
 
63
        rsRetVal (*SetCBIsPermittedHost)(tcpsrv_t*, int (*) (struct sockaddr *addr, char*, void*, void*));
 
64
        rsRetVal (*SetCBOpenLstnSocks)(tcpsrv_t *, int* (*)(tcpsrv_t*));
 
65
        rsRetVal (*SetCBRcvData)(tcpsrv_t *, int (*)(tcps_sess_t*, char*, size_t));
 
66
        rsRetVal (*SetCBOnListenDeinit)(tcpsrv_t*, rsRetVal (*)(void*));
 
67
        rsRetVal (*SetCBOnDestruct)(tcpsrv_t*, rsRetVal (*) (void*));
 
68
        rsRetVal (*SetCBOnRegularClose)(tcpsrv_t*, rsRetVal (*) (tcps_sess_t*));
 
69
        rsRetVal (*SetCBOnErrClose)(tcpsrv_t*, rsRetVal (*) (tcps_sess_t*));
 
70
        /* session specifics */
 
71
        rsRetVal (*SetCBOnSessAccept)(tcpsrv_t*, rsRetVal (*) (tcpsrv_t*, tcps_sess_t*));
 
72
        rsRetVal (*SetCBOnSessDestruct)(tcpsrv_t*, rsRetVal (*) (void*));
 
73
        rsRetVal (*SetCBOnSessConstructFinalize)(tcpsrv_t*, rsRetVal (*) (void*));
 
74
ENDinterface(tcpsrv)
 
75
#define tcpsrvCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */
 
76
 
 
77
 
 
78
/* prototypes */
 
79
PROTOTYPEObj(tcpsrv);
 
80
 
 
81
/* the name of our library binary */
 
82
#define LM_TCPSRV_FILENAME "lmtcpsrv"
 
83
 
 
84
#endif /* #ifndef INCLUDED_TCPSRV_H */