root/src/stratcon_iep.h

Revision 304ec80b8cf842fc0abe5f9029790908b6455957, 3.1 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 2 months ago)

Convert to libmtev.

  • Property mode set to 100644
Line 
1 /*
2  * Copyright (c) 2007, OmniTI Computer Consulting, Inc.
3  * All rights reserved.
4  * Copyright (c) 2015, Circonus, Inc. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above
13  *       copyright notice, this list of conditions and the following
14  *       disclaimer in the documentation and/or other materials provided
15  *       with the distribution.
16  *     * Neither the name OmniTI Computer Consulting, Inc. nor the names
17  *       of its contributors may be used to endorse or promote products
18  *       derived from this software without specific prior written
19  *       permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef _NOIT_STRATCON_IEP_H
35 #define _NOIT_STRATCON_IEP_H
36
37 #include <mtev_defines.h>
38
39 #include <sys/types.h>
40 #include <sys/socket.h>
41
42 #include <eventer/eventer.h>
43 #include <mtev_hash.h>
44
45 #include "stratcon_datastore.h"
46 #include "stratcon_jlog_streamer.h"
47
48 API_EXPORT(void)
49   stratcon_iep_init();
50
51 API_EXPORT(void)
52   stratcon_iep_line_processor(stratcon_datastore_op_t op,
53                               struct sockaddr *remote, const char *remote_cn,
54                               void *operand, eventer_t completion);
55
56 API_EXPORT(jlog_streamer_ctx_t *)
57   stratcon_jlog_streamer_iep_ctx_alloc(void);
58
59 typedef struct iep_thread_driver iep_thread_driver_t;
60
61 typedef struct mq_driver {
62   iep_thread_driver_t *(*allocate)(mtev_conf_section_t);
63
64   int (*connect)(iep_thread_driver_t *driver);
65   /* connect returns:
66       -1 for failure,
67        0 for successful new connection,
68        1 for already connected
69    */
70
71   int (*submit)(iep_thread_driver_t *driver, const char *payload, size_t payloadlen);
72   /* submit returns: 0 on success, -1 on failure */
73
74   int (*disconnect)(iep_thread_driver_t *driver);
75   /* disconnect returns:
76       -1 for already disconnected
77        0 successful discnonect
78    */
79
80   void (*deallocate)(iep_thread_driver_t *driver);
81 } mq_driver_t;
82
83 API_EXPORT(void)
84   stratcon_iep_mq_driver_register(const char *, mq_driver_t *);
85
86 API_EXPORT(int)
87   stratcon_iep_get_enabled();
88
89 API_EXPORT(void)
90   stratcon_iep_set_enabled(int);
91
92 #endif
Note: See TracBrowser for help on using the browser.