Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a select for Martin.
[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 BEGIN_DECL()
13
14 /** \defgroup m_datatypes_management MSG Data Types 
15     \brief This section describes the different datatypes provided by MSG.
16 */
17
18 /********************************* Host **************************************/
19
20 /** @name Host datatype  
21     \ingroup m_datatypes_management
22
23     A <em>location</em> (or <em>host</em>) is any possible place where
24     a process may run. Thus it is represented as a <em>physical
25     resource with computing capabilities</em>, some <em>mailboxes</em>
26     to enable running process to communicate with remote ones, and
27     some <em>private data</em> that can be only accessed by local
28     process.
29
30     \see m_host_management
31 */
32 /* @{ */
33 typedef struct simdata_host *simdata_host_t;
34 typedef struct m_host {
35   char *name;                   /**< host name if any */
36   simdata_host_t simdata;       /**< simulator data */
37   void *data;                   /**< user data */
38 } s_m_host_t, *m_host_t;
39 /* @} */
40 /********************************* Task **************************************/
41
42 /** @name Task datatype  
43     \ingroup m_datatypes_management 
44
45     A <em>task</em> may then be defined by a <em>computing
46     amount</em>, a <em>message size</em> and some <em>private
47     data</em>.
48     \see m_task_management
49 */
50 /* @{ */
51 typedef struct simdata_task *simdata_task_t;
52 typedef struct m_task {
53   char *name;                   /* host name if any */
54   simdata_task_t simdata;       /* simulator data */
55   void *data;                   /* user data */
56 } s_m_task_t, *m_task_t;
57
58 /** \brief Default value for an uninitialized #m_task_t.
59     \ingroup m_datatypes_management 
60 */
61 #define MSG_TASK_UNINITIALIZED NULL
62
63 /* @} */
64
65 /******************************* Process *************************************/
66
67 /** @name Agent datatype  
68     \ingroup m_datatypes_management 
69
70     An agent may be defined as a <em>code</em>, with some <em>private
71     data</em>, executing in a <em>location</em>.
72     \see m_process_management
73 */
74 /* @{ */
75 typedef struct simdata_process *simdata_process_t;
76 typedef struct m_process {
77   /** A name */
78   /** process name if any */
79   char *name;                   
80   simdata_process_t simdata;    /* simulator data */
81   void *data;                   /* user data */
82 } s_m_process_t, *m_process_t;
83
84 /** 
85     The code of an agent is a m_process_code_t, i.e. a function with no arguments 
86     returning no value.
87     \see m_process_management
88 */
89 typedef int(*m_process_code_t)(int argc,char *argv[]) ;
90 /* @} */
91
92 /********************************** Channel **********************************/
93 /** @name Channel datatype  
94     \ingroup m_datatypes_management 
95
96     A <em>channel</em>  is a number and identifies a mailbox type (just as a 
97     port number does).
98     \see m_channel_management
99 */
100 /* @{ */
101 typedef int m_channel_t;
102 /* @} */
103
104 /****************************** Error handling *******************************/
105 /** \brief Error handling
106 */typedef enum {
107   MSG_OK = 0,  /**< Everything is right. Keep on going this way ! */
108   MSG_WARNING, /**< Mmmh! Something must be not perfectly clean. But I
109       may be a paranoid freak... ! */
110   MSG_TRANSFER_FAILURE, /**< There has been a problem during you task
111       transfer. Either the network is down or the remote host has been
112       shutdown. */
113   MSG_HOST_FAILURE, /**< System shutdown. The host on which you are
114       running has just been rebooted. Free your datastructures and
115       return now !*/
116   MSG_FATAL /**< You've done something wrong. You'd better look at it... */
117 } MSG_error_t;
118
119 typedef enum {
120   MSG_SILENT = 0,
121   MSG_SOME,
122   MSG_VERBOSE
123 } MSG_outputmode_t;
124
125 /** \deprecated Network sharing mechanism
126     \ingroup m_datatypes_management*/
127 typedef enum {
128   MSG_STORE_AND_FORWARD = 1, /* 0 means uninitialized value */
129   MSG_TCP
130 } MSG_sharing_t;
131
132 /** \deprecated Link datatype  
133  *  \ingroup m_datatypes_management
134  *    The notion of <em>link</em> was present in the earliest versions of MSG.  
135  *    It was an agglomeration of communicating resources representing a set of
136  *    physical network links. This abstraction a disappeared because in real-life,
137  *    it is generally not possible to interact directly with a link...
138  */
139 typedef struct m_link *m_link_t;
140
141 END_DECL()
142 #endif