Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
9e976d402c431cb5d01df4fe821074b2a9bd675b
[simgrid.git] / examples / msg / chainsend / messages.h
1 /* Copyright (c) 2012-2015. 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 KADEPLOY_MESSAGES_H
8 #define KADEPLOY_MESSAGES_H
9
10 #include "simgrid/msg.h"
11 #include "xbt/sysdep.h"
12
13 #define MESSAGE_BUILD_CHAIN_SIZE 40
14 #define MESSAGE_SEND_DATA_HEADER_SIZE 1
15 #define MESSAGE_END_DATA_SIZE 1
16
17 /* Messages enum */
18 typedef enum {
19   MESSAGE_BUILD_CHAIN = 0,
20   MESSAGE_SEND_DATA
21 } e_message_type;
22
23 /* Message struct */
24 typedef struct s_message {
25   e_message_type type;
26   char *prev_hostname;
27   char *next_hostname;
28   const char *data_block;
29   unsigned int data_length;
30   unsigned int num_pieces;
31 } s_message_t, *message_t;
32
33 /* Message methods */
34 msg_task_t task_message_new(e_message_type type, unsigned int len);
35 msg_task_t task_message_chain_new(const char* prev, const char *next, const unsigned int num_pieces);
36 msg_task_t task_message_data_new(const char *block, unsigned int len);
37 void task_message_delete(void *);
38
39 #endif /* KADEPLOY_MESSAGES_H */