Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
26263dae788d2a28e41f44b3881c0ca9f28c76db
[simgrid.git] / include / msg / datatypes.h
1 /* Copyright (c) 2004, 2005, 2007, 2008, 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 MSG_DATATYPE_H
8 #define MSG_DATATYPE_H
9 #include "xbt/misc.h"
10
11 SG_BEGIN_DECL()
12
13 /* ******************************** Host ************************************ */
14 /** @defgroup m_datatypes_management_details Details on MSG datatypes
15     @ingroup  m_datatypes_management*/
16      typedef struct simdata_host *simdata_host_t;
17 /** @brief Host datatype 
18     @ingroup m_datatypes_management_details */
19      typedef struct m_host {
20        char *name;              /**< @brief host name if any */
21        simdata_host_t simdata;  /**< @brief simulator data */
22        void *data;              /**< @brief user data */
23      } s_m_host_t;
24 /** @brief Host datatype  
25     @ingroup m_datatypes_management
26
27     A <em>location</em> (or <em>host</em>) is any possible place where
28     a process may run. Thus it is represented as a <em>physical
29     resource with computing capabilities</em>, some <em>mailboxes</em>
30     to enable running process to communicate with remote ones, and
31     some <em>private data</em> that can be only accessed by local
32     process.
33
34     \see m_host_management
35   @{ */
36      typedef struct m_host *m_host_t;
37 /** @} */
38 /* ******************************** Task ************************************ */
39
40      typedef struct simdata_task *simdata_task_t;
41 /** @brief Task datatype 
42     @ingroup m_datatypes_management_details */
43      typedef struct m_task {
44        char *name;              /**< @brief task name if any */
45        simdata_task_t simdata;  /**< @brief simulator data */
46        void *data;              /**< @brief user data */
47 #ifdef HAVE_TRACING
48        long long int counter;   /* task unique identifier for instrumentation */
49        char *category;      /* task category for instrumentation */
50 #endif
51      } s_m_task_t;
52 /** @brief Task datatype  
53     @ingroup m_datatypes_management 
54
55     A <em>task</em> may then be defined by a <em>computing
56     amount</em>, a <em>message size</em> and some <em>private
57     data</em>.
58     \see m_task_management
59   @{ */
60      typedef struct m_task *m_task_t;
61
62 /** \brief Default value for an uninitialized #m_task_t.
63     \ingroup m_datatypes_management 
64 */
65 #define MSG_TASK_UNINITIALIZED NULL
66
67      typedef struct s_smx_comm *msg_comm_t;
68 /** @} */
69
70
71
72 /* ****************************** Process *********************************** */
73      typedef struct simdata_process *simdata_process_t;
74 /** @brief Process datatype 
75     @ingroup m_datatypes_management_details @{ */
76      typedef struct m_process {
77        char *name;              /**< @brief process name if any */
78        simdata_process_t simdata;
79                                 /**< @brief simulator data */
80        void *data;              /**< @brief user data */
81        char *category;      /* process category for instrumentation */
82      } s_m_process_t;
83 /** @} */
84 /** @brief Agent datatype  
85     @ingroup m_datatypes_management 
86
87     An agent may be defined as a <em>code</em>, with some <em>private
88     data</em>, executing in a <em>location</em>.
89     \see m_process_management
90   @{ */
91      typedef struct m_process *m_process_t;
92 /** @} */
93
94 /* ********************************* Channel ******************************** */
95 /** @brief Channel datatype  
96     @ingroup m_datatypes_management 
97
98     A <em>channel</em>  is a number and identifies a mailbox type (just as a 
99     port number does).
100     \see m_channel_management
101    @{ */
102      typedef int m_channel_t;
103 /** @} */
104
105 /* ******************************** Mailbox ************************************ */
106
107      typedef struct s_msg_mailbox *msg_mailbox_t;
108 /** @brief Mailbox datatype
109     @ingroup m_datatypes_management_details @{ */
110
111      msg_mailbox_t MSG_mailbox_create(const char *alias);
112      void MSG_mailbox_free(void *mailbox);
113
114
115 /** @} */
116
117
118 /* ***************************** Error handling ***************************** */
119 /** @brief Error handling 
120     @ingroup m_datatypes_management 
121     @{
122 */ /* Keep these code as binary values: java bindings manipulate | of these values */
123      typedef enum {
124        MSG_OK = 0,            /**< @brief Everything is right. Keep on going this way ! */
125        MSG_TIMEOUT=1,         /**< @brief nothing good happened before the timer you provided elapsed */
126        MSG_TRANSFER_FAILURE=2,/**< @brief There has been a problem during you task
127       transfer. Either the network is down or the remote host has been
128       shutdown. */
129        MSG_HOST_FAILURE=4,    /**< @brief System shutdown. The host on which you are
130       running has just been rebooted. Free your datastructures and
131       return now !*/
132        MSG_TASK_CANCELLED=8,  /**< @brief Canceled task. This task has been canceled by somebody!*/
133      } MSG_error_t;
134 /** @} */
135
136 SG_END_DECL()
137 #endif