lwes_emitter.h

Go to the documentation of this file.
00001 /*======================================================================*
00002  * Copyright (C) 2008 Light Weight Event System                         *
00003  * All rights reserved.                                                 *
00004  *                                                                      *
00005  * This program is free software; you can redistribute it and/or modify *
00006  * it under the terms of the GNU General Public License as published by *
00007  * the Free Software Foundation; either version 2 of the License, or    *
00008  * (at your option) any later version.                                  *
00009  *                                                                      *
00010  * This program is distributed in the hope that it will be useful,      *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
00013  * GNU General Public License for more details.                         *
00014  *                                                                      *
00015  * You should have received a copy of the GNU General Public License    *
00016  * along with this program; if not, write to the Free Software          *
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor,                   *
00018  * Boston, MA 02110-1301 USA.                                           *
00019  *======================================================================*/
00020 #ifndef __LWES_EMITTER_H
00021 #define __LWES_EMITTER_H
00022 
00023 #include "lwes_types.h"
00024 #include "lwes_net_functions.h"
00025 #include "lwes_event.h"
00026 
00027 #include <stdio.h>
00028 #include <time.h>
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif 
00033 
00041 struct lwes_emitter
00042 {
00044   struct lwes_net_connection connection;
00046   LWES_BYTE_P buffer;
00048   LWES_INT_64 count;
00050   LWES_INT_64 count_since_last_beat;
00052   LWES_INT_64 sequence;
00054   LWES_INT_16 frequency;
00056   LWES_BOOLEAN emitHeartbeat;
00058   time_t last_beat_time;
00059 };
00060 
00076 struct lwes_emitter *
00077 lwes_emitter_create
00078   (LWES_CONST_SHORT_STRING address,
00079    LWES_CONST_SHORT_STRING iface,
00080    LWES_U_INT_32 port,
00081    LWES_BOOLEAN emit_heartbeat,
00082    LWES_INT_16 freq);
00083 
00100 struct lwes_emitter *
00101 lwes_emitter_create_with_ttl
00102   (LWES_CONST_SHORT_STRING address,
00103    LWES_CONST_SHORT_STRING iface,
00104    LWES_U_INT_32 port,
00105    LWES_BOOLEAN emit_heartbeat,
00106    LWES_INT_16 freq,
00107    LWES_U_INT_32 ttl);
00108 
00116 int
00117 lwes_emitter_emit
00118   (struct lwes_emitter *emitter,
00119    struct lwes_event *event);
00120 
00133 int
00134 lwes_emitter_emitto
00135   (LWES_SHORT_STRING address,
00136    LWES_SHORT_STRING iface,
00137    LWES_U_INT_32 port,
00138    struct lwes_emitter *emitter,
00139    struct lwes_event *event);
00140 
00152 int
00153 lwes_emitter_emit_bytes
00154   (struct lwes_emitter *emitter,
00155    LWES_BYTE_P bytes,
00156    size_t length);
00157 
00165 int
00166 lwes_emitter_destroy
00167   (struct lwes_emitter *emitter);
00168 
00169 #ifdef __cplusplus
00170 }
00171 #endif 
00172 
00173 #endif /* __LWES_EMITTER_H */

Generated on Thu Aug 21 07:18:55 2008 for lwes by  doxygen 1.4.6