3 /* gras_addons - several addons to do specific stuff not in GRAS itself */
5 /* Authors: Martin Quinson */
6 /* Copyright (C) 2003 the OURAGAN project. */
8 /* This program is free software; you can redistribute it and/or modify it
9 under the terms of the license (GNU LGPL) which comes with this package. */
16 #define HOSTNAME_LEN 256
19 /* ****************************************************************************
20 * The common types used as payload in the messages and their definitions
21 * ****************************************************************************/
26 * Description of an host
30 char host[HOSTNAME_LEN];
34 static const DataDescriptor msgHostDesc[] =
35 { SIMPLE_MEMBER(CHAR_TYPE,HOSTNAME_LEN,offsetof(msgHost_t,host)),
36 SIMPLE_MEMBER(UNSIGNED_INT_TYPE,1, offsetof(msgHost_t,port))};
42 * how to indicate an eventual error
46 char errmsg[ERRMSG_LEN];
50 static const DataDescriptor msgErrorDesc[] =
51 { SIMPLE_MEMBER(CHAR_TYPE, ERRMSG_LEN,offsetof(msgError_t,errmsg)),
52 SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(msgError_t,errcode))};
58 * how to report the result of an experiment
62 unsigned int timestamp;
66 static const DataDescriptor msgResultDesc[] =
67 { SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(msgResult_t,timestamp)),
68 SIMPLE_MEMBER(DOUBLE_TYPE, 1, offsetof(msgResult_t,value))};
69 #define msgResultLen 2
74 * Repports an error to the process listening on socket sock.
76 * The information will be embeeded in a message of type id, which must take a msgError_t as first
77 * sequence (and SeqCount sequences in total). Other sequences beside the error one will be of
80 * The message will be builded as sprintf would, using the given format and extra args.
82 * If the message cannot be builded and sent to recipient, the string severeError will be printed
83 * on localhost's stderr.
86 grasRepportError (gras_sock_t *sock, gras_msgid_t id, int SeqCount,
87 const char *severeError,
88 gras_error_t errcode, const char* format,...);
90 #endif /* GRAS_ADDONS_H */