-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvl.h
56 lines (47 loc) · 1.82 KB
/
envl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef ENVL_H
#define ENVL_H
#include "const.h"
#include "outs.h"
#define ENVL_RESERVED_SIZE 32
#define ENVL_MSGTEXT_SIZE 64
typedef struct envl {
// message header
// 32 bytes
struct envl* next; // used to build message deque
struct envl* prev;
PROCESS_ID sender_pid;
PROCESS_ID destination_pid;
MESSAGE_TYPE msg_type;
SYSTIME sent_time;
SYSTIME delivery_time; // indicates when this message should be received (for delayed_send())
/*
"Test processes will use an offset of 64-bytes from the pointer (to a
message envelope) and use that area (within the message text) for inter
test process communication. So, none of your primitives should modify
this message text area while handling a message envelope
(i.e. deallocate, allocate, delay, etc.). This area, within the message
text, is only used by the test processes while they "own" an
envelope. Of course, your own processes can do anything they want with
this area when they "own" an envelope.
"
*/
// message text
// 96 bytes
char reserved[ENVL_RESERVED_SIZE];
char msgtext[ENVL_MSGTEXT_SIZE];
} envl;
int envl_clear(envl* in_envl);
int envl_set_sender(envl* env, PROCESS_ID sender_pid);
int envl_set_destination(envl* env, PROCESS_ID destination_pid);
int envl_set_sent_time(envl* in_envl, SYSTIME in_stime);
int envl_set_delivery_time(envl* in_envl, SYSTIME in_dtime);
int envl_set_message_type(envl* env, MESSAGE_TYPE msg_type);
//int envl_set_msgtext(envl* in_envl, char* in_msgtext); // moved to func.c
PROCESS_ID envl_get_sender_id(envl* in_envl);
MESSAGE_TYPE envl_get_message_type(envl* in_envl);
PROCESS_ID envl_get_destination_pid(envl* in_envl);
SYSTIME envl_get_sent_time(envl* in_envl);
SYSTIME envl_get_delivery_time(envl* in_envl);
char* envl_get_msgtext(envl* in_envl);
int envl_print(envl* in_envl);
#endif /* ENVL_H */