Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a indent rule to format the code in an uniform way, avoiding breaking the branche...
[simgrid.git] / include / msg / datatypes.h
1 /*      $Id$     */
2
3 /* Copyright (c) 2002,2003,2004 Arnaud Legrand. All rights reserved.        */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #ifndef MSG_DATATYPE_H
9 #define MSG_DATATYPE_H
10 #include "xbt/misc.h"
11
12 SG_BEGIN_DECL()
13
14 /* ******************************** Host ************************************ */
15 /** @defgroup m_datatypes_management_details Details on MSG datatypes
16     @ingroup  m_datatypes_management*/
17
18 typedef struct simdata_host *simdata_host_t;
19 /** @brief Host datatype 
20     @ingroup m_datatypes_management_details */
21 typedef struct m_host {
22   char *name;                   /**< @brief host name if any */
23   simdata_host_t simdata;       /**< @brief simulator data */
24   void *data;                   /**< @brief user data */
25 } s_m_host_t;
26 /** @brief Host datatype  
27     @ingroup m_datatypes_management
28
29     A <em>location</em> (or <em>host</em>) is any possible place where
30     a process may run. Thus it is represented as a <em>physical
31     resource with computing capabilities</em>, some <em>mailboxes</em>
32     to enable running process to communicate with remote ones, and
33     some <em>private data</em> that can be only accessed by local
34     process.
35
36     \see m_host_management
37   @{ */
38 typedef struct m_host *m_host_t;
39 /** @} */
40 /* ******************************** Task ************************************ */
41
42 typedef struct simdata_task *simdata_task_t;
43 /** @brief Task datatype 
44     @ingroup m_datatypes_management_details */
45 typedef struct m_task {
46   char *name;                   /**< @brief task name if any */
47   simdata_task_t simdata;       /**< @brief simulator data */
48   void *data;                   /**< @brief user data */
49 } s_m_task_t;
50 /** @brief Task datatype  
51     @ingroup m_datatypes_management 
52
53     A <em>task</em> may then be defined by a <em>computing
54     amount</em>, a <em>message size</em> and some <em>private
55     data</em>.
56     \see m_task_management
57   @{ */
58 typedef struct m_task  *m_task_t;
59
60 /** \brief Default value for an uninitialized #m_task_t.
61     \ingroup m_datatypes_management 
62 */
63 #define MSG_TASK_UNINITIALIZED NULL
64
65 /** @} */
66
67
68
69 /* ****************************** Process *********************************** */
70 typedef struct simdata_process *simdata_process_t;
71 /** @brief Process datatype 
72     @ingroup m_datatypes_management_details @{ */
73 typedef struct m_process {
74   char *name;                   /**< @brief process name if any */
75   simdata_process_t simdata;    /**< @brief simulator data */
76   void *data;                   /**< @brief user data */
77 } s_m_process_t;
78 /** @} */
79 /** @brief Agent datatype  
80     @ingroup m_datatypes_management 
81
82     An agent may be defined as a <em>code</em>, with some <em>private
83     data</em>, executing in a <em>location</em>.
84     \see m_process_management
85   @{ */
86 typedef struct m_process *m_process_t;
87 /** @} */
88
89 /* ********************************* Channel ******************************** */
90 /** @brief Channel datatype  
91     @ingroup m_datatypes_management 
92
93     A <em>channel</em>  is a number and identifies a mailbox type (just as a 
94     port number does).
95     \see m_channel_management
96    @{ */
97 typedef int m_channel_t;
98 /** @} */
99
100 /* ******************************** Mailbox ************************************ */
101
102 typedef struct s_msg_mailbox* msg_mailbox_t;
103 /** @brief Mailbox datatype
104     @ingroup m_datatypes_management_details @{ */
105
106 msg_mailbox_t MSG_mailbox_create(const char *alias);
107 void MSG_mailbox_free(void* mailbox);
108
109
110 /** @} */
111
112
113 /* ***************************** Error handling ***************************** */
114 /** @brief Error handling 
115     @ingroup m_datatypes_management 
116     @{
117 */
118 typedef enum {
119   MSG_OK = 0,  /**< @brief Everything is right. Keep on going this way ! */
120   MSG_WARNING, /**< @brief Mmmh! Something must be not perfectly clean. But I
121       may be a paranoid freak... ! */
122   MSG_TRANSFER_FAILURE, /**< @brief There has been a problem during you task
123       transfer. Either the network is down or the remote host has been
124       shutdown. */
125   MSG_HOST_FAILURE, /**< @brief System shutdown. The host on which you are
126       running has just been rebooted. Free your datastructures and
127       return now !*/
128   MSG_TASK_CANCELLED, /**< @brief Cancelled task. This task has been cancelled 
129                         by somebody!*/
130   MSG_FATAL /**< @brief You've done something wrong. You'd better look at it... */
131 } MSG_error_t;
132 /** @} */
133
134 SG_END_DECL()
135 #endif