Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
1064d2775d5af8129b520bb71cc0634c5a5dfc87
[simgrid.git] / src / include / simix / datatypes.h
1 /* Copyright (c) 2007, 2009, 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef _SIMIX_DATATYPES_H
8 #define _SIMIX_DATATYPES_H
9 #include "xbt/misc.h"
10 #include "xbt/swag.h"
11 #include "xbt/fifo.h"
12
13 SG_BEGIN_DECL()
14
15 /* ******************************** Host ************************************ */
16 /** @defgroup m_datatypes_management_details Details on SIMIX datatypes */
17 /** @brief Host datatype  
18     @ingroup m_datatypes_management
19
20     A <em>location</em> (or <em>host</em>) is any possible place where
21     a process may run. Thus it is represented as a <em>physical
22     resource with computing capabilities</em>, some <em>mailboxes</em>
23     to enable running process to communicate with remote ones, and
24     some <em>private data</em> that can be only accessed by local
25     process.
26
27     \see m_host_management
28   @{ */
29 typedef struct s_smx_host *smx_host_t;
30 typedef enum {
31   SIMIX_WAITING,
32   SIMIX_READY,
33   SIMIX_RUNNING,
34   SIMIX_DONE,
35   SIMIX_CANCELED,
36   SIMIX_FAILED,
37   SIMIX_SRC_HOST_FAILURE,
38   SIMIX_DST_HOST_FAILURE,
39   SIMIX_SRC_TIMEOUT,
40   SIMIX_DST_TIMEOUT,
41   SIMIX_LINK_FAILURE,
42 } e_smx_state_t;
43 /** @} */
44
45
46 typedef struct s_smx_timer* smx_timer_t;
47
48
49 /* ******************************** Synchro ************************************ */
50 typedef struct s_smx_mutex *smx_mutex_t;
51 typedef struct s_smx_cond *smx_cond_t;
52 typedef struct s_smx_sem *smx_sem_t;
53
54 /********************************** Action *************************************/
55 typedef struct s_smx_action *smx_action_t; /* FIXME: replace by specialized action handlers */
56
57
58
59 /* ****************************** Process *********************************** */
60 /** @brief Agent datatype  
61     @ingroup m_datatypes_management 
62
63     An agent may be defined as a <em>code</em>, with some <em>private
64     data</em>, executing in a <em>location</em>.
65     \see m_process_management
66   @{ */
67 typedef struct s_smx_process *smx_process_t;
68 /** @} */
69
70 typedef struct s_smx_context *smx_context_t;
71
72 /* User create and kill process, the function must accept the folling parameters:
73  * const char *name: a name for the object. It is for user-level information and can be NULL
74  * xbt_main_func_t code: is a function describing the behavior of the agent
75  * void *data: data a pointer to any data one may want to attach to the new object.
76  * smx_host_t host: the location where the new agent is executed
77  * int argc, char **argv: parameters passed to code
78  *
79  * */
80 typedef void *(*smx_creation_func_t) ( /*name */ const char *,
81                                       /*code */ xbt_main_func_t,
82                                       /*userdata */ void *,
83                                       /*hostname */ char *,
84                                       /* argc */ int,
85                                       /* argv */ char **,
86                                       /* props */ xbt_dict_t);
87
88
89 /******************************* Networking ***********************************/
90 typedef struct s_smx_rvpoint *smx_rdv_t;
91
92
93 SG_END_DECL()
94 #endif