Logo AND Algorithmique Numérique Distribuée

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