00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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