Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Missing chunks
[simgrid.git] / include / amok / base.h
1 /* $Id$ */
2
3 /* amok_base - things needed in amok, but too small to constitute a module  */
4
5 /* Authors: Martin Quinson                                                  */
6 /* Copyright (C) 2003, 2004 the OURAGAN project.                            */
7
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. */
10
11 #ifndef AMOK_BASE_H
12 #define AMOK_BASE_H
13
14 #include "gras/messages.h"
15
16 /* ****************************************************************************
17  * The common types used as payload in the messages and their definitions
18  * ****************************************************************************/
19
20 /**
21  * amok_remoterr_t:
22  *
23  * how to indicate an eventual error
24  */
25
26 typedef struct {
27   char *msg;
28   unsigned int code;
29 } s_amok_remoterr_t,*amok_remoterr_t;
30
31 amok_remoterr_t amok_remoterr_new(gras_error_t errcode, 
32                                   const char* format, ...);
33 amok_remoterr_t amok_remoterr_new_va(gras_error_t param_errcode, 
34                                      const char* format,va_list ap);
35 void amok_remoterr_free(amok_remoterr_t *err);
36
37
38 /**
39  * amok_result_t:
40  *
41  * how to report the result of an experiment
42  */
43
44 typedef struct {
45   unsigned int timestamp;
46   double value;
47 } amok_result_t;
48
49 /**
50  * amok_repport_error:
51  *
52  * Repports an error to the process listening on socket sock. 
53  *
54  * The information will be embeeded in a message of type id, which must take a msgError_t as first
55  * sequence (and SeqCount sequences in total). Other sequences beside the error one will be of
56  * length 0.
57  *
58  * The message will be builded as sprintf would, using the given format and extra args.
59  *
60  * If the message cannot be builded and sent to recipient, the string severeError will be printed
61  * on localhost's stderr.
62  */
63 void
64 amok_repport_error (gras_socket_t sock, gras_msgtype_t msgtype,
65                     gras_error_t errcode, const char* format,...);
66
67
68 void amok_base_init(void);
69 void amok_base_exit(void);
70
71
72 #endif /* AMOK_BASE_H */