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