2 * Copyright (c) 2007, Anthony Minessale II
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * * Neither the name of the original author; nor the names of any contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
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 OWNER
25 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 #define this_check(x) do { if (!this) { esl_log(ESL_LOG_ERROR, "object is not initalized\n"); return x;}} while(0)
42 #define this_check_void() do { if (!this) { esl_log(ESL_LOG_ERROR, "object is not initalized\n"); return;}} while(0)
47 esl_event_header_t *hp;
50 char *serialized_string;
53 ESLevent(const char *type, const char *subclass_name = NULL);
54 ESLevent(esl_event_t *wrap_me, int free_me = 0);
55 ESLevent(ESLevent *me);
57 const char *serialize(const char *format = NULL);
58 bool setPriority(esl_priority_t priority = ESL_PRIORITY_NORMAL);
59 const char *getHeader(const char *header_name);
61 const char *getType(void);
62 bool addBody(const char *value);
63 bool addHeader(const char *header_name, const char *value);
64 bool delHeader(const char *header_name);
65 const char *firstHeader(void);
66 const char *nextHeader(void);
74 ESLevent *last_event_obj;
76 ESLconnection(const char *host, const char *port, const char *password);
77 ESLconnection(int socket);
78 virtual ~ESLconnection();
81 int send(const char *cmd);
82 ESLevent *sendRecv(const char *cmd);
83 ESLevent *api(const char *cmd, const char *arg = NULL);
84 ESLevent *bgapi(const char *cmd, const char *arg = NULL);
85 int sendEvent(ESLevent *send_me);
86 ESLevent *recvEvent();
87 ESLevent *recvEventTimed(int ms);
88 ESLevent *filter(const char *header, const char *value);
89 int events(const char *etype, const char *value);
90 int execute(const char *app, const char *arg = NULL, const char *uuid = NULL);
91 int executeAsync(const char *app, const char *arg = NULL, const char *uuid = NULL);
92 int setAsyncExecute(const char *val);
93 int setEventLock(const char *val);
97 void eslSetLogLevel(int level);