Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix (C) dates
[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 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10 #ifndef AMOK_BASE_H
11 #define AMOK_BASE_H
12
13 #include "gras/messages.h"
14
15 /* ****************************************************************************
16  * The common types used as payload in the messages and their definitions
17  * ****************************************************************************/
18
19 /**
20  * amok_remoterr_t:
21  *
22  * how to indicate an eventual error
23  */
24
25 typedef struct {
26   char *msg;
27   unsigned int code;
28 } s_amok_remoterr_t,*amok_remoterr_t;
29
30 amok_remoterr_t amok_remoterr_new(xbt_error_t errcode, 
31                                   const char* format, ...);
32 amok_remoterr_t amok_remoterr_new_va(xbt_error_t param_errcode, 
33                                      const char* format,va_list ap);
34 void amok_remoterr_free(amok_remoterr_t *err);
35
36
37 /**
38  * amok_result_t:
39  *
40  * how to report the result of an experiment
41  */
42
43 typedef struct {
44   unsigned int timestamp;
45   double value;
46 } amok_result_t;
47
48 /**
49  * amok_repport_error:
50  *
51  * Repports an error to the process listening on socket sock. 
52  *
53  * The information will be embeeded in a message of type id, which must take a msgError_t as first
54  * sequence (and SeqCount sequences in total). Other sequences beside the error one will be of
55  * length 0.
56  *
57  * The message will be builded as sprintf would, using the given format and extra args.
58  *
59  * If the message cannot be builded and sent to recipient, the string severeError will be printed
60  * on localhost's stderr.
61  */
62 void
63 amok_repport_error (gras_socket_t sock, gras_msgtype_t msgtype,
64                     xbt_error_t errcode, const char* format,...);
65
66
67 void amok_base_init(void);
68 void amok_base_exit(void);
69
70
71 #endif /* AMOK_BASE_H */