00001 #ifndef __M_TRANSPORT_H__
00002 #define __M_TRANSPORT_H__
00003
00004 #include "mondemand_trace.h"
00005
00006
00007
00008
00009 struct mondemand_context
00010 {
00011 const char *key;
00012 const char *value;
00013 };
00014
00015
00016 struct mondemand_log_message
00017 {
00018 const char *filename;
00019 int line;
00020 int level;
00021 int repeat_count;
00022 const char *message;
00023 struct mondemand_trace_id trace_id;
00024 };
00025
00026
00027 struct mondemand_stats_message
00028 {
00029 const char *key;
00030 #if HAVE_LONG_LONG
00031 long long counter;
00032 #else
00033 long counter;
00034 #endif
00035 };
00036
00037
00038
00039
00040 struct mondemand_transport *mondemand_transport_stderr_create(void);
00041 void mondemand_transport_stderr_destroy(struct mondemand_transport *transport);
00042
00043
00044 struct mondemand_transport *mondemand_transport_lwes_create(
00045 const char *address, const int port,
00046 const char *interface, int emit_heartbeat,
00047 int heartbeat_frequency);
00048 struct mondemand_transport *mondemand_transport_lwes_create_with_ttl(
00049 const char *address, const int port,
00050 const char *interface, int emit_heartbeat,
00051 int heartbeat_frequency, int ttl);
00052 void mondemand_transport_lwes_destroy(struct mondemand_transport *transport);
00053
00054
00055 typedef int (*mondemand_transport_log_sender_t)
00056 (const char *program_identifier,
00057 const struct mondemand_log_message[],
00058 const int message_count,
00059 const struct mondemand_context[],
00060 const int context_count,
00061 void *);
00062
00063
00064 typedef int (*mondemand_transport_stats_sender_t)
00065 (const char *program_identifier,
00066 const struct mondemand_stats_message[],
00067 const int message_count,
00068 const struct mondemand_context[],
00069 const int context_count,
00070 void *);
00071
00072
00073 struct mondemand_transport
00074 {
00075 mondemand_transport_log_sender_t log_sender_function;
00076 mondemand_transport_stats_sender_t stats_sender_function;
00077 void *userdata;
00078 };
00079
00080 #endif