-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail.h
More file actions
87 lines (65 loc) · 2.24 KB
/
mail.h
File metadata and controls
87 lines (65 loc) · 2.24 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
mail.h
Mail System Simulator
7-15-2016
Neil McGlohon
*/
#ifndef _mail_h
#define _mail_h
#include "ross.h"
#define MEAN_MAILBOX_WAIT .005
#define MEAN_PO_PROCESS_WAIT .01
// #define MEAN_PO_PROCESS_WAIT 45.0
#define LET_PER_MAILBOX 1
//STRUCTS ------------------------------
typedef struct
{
tw_lpid sender;
tw_lpid final_dest;
tw_lpid next_dest;
} letter;
typedef struct
{
int num_letters_sent;
int num_letters_recvd;
//TODO consider an inbox so that there could maybe be ad-hoc p2p messaging, interesting model
} mailbox_state;
typedef struct
{
int num_letters_sent;
int num_letters_recvd;
//TODO consider an inbox so that there could maybe be ad-hoc p2p messaging, interesting model
} post_office_state;
//MAPPING -----------------------------
enum lpTypeVals
{
MAILBOX = 0,
POSTOFFICE = 1
};
extern tw_lpid lpTypeMapper(tw_lpid gid);
extern tw_peid mail_map(tw_lpid gid);
extern int get_mailbox_GID(int lpid);
extern int get_post_office_GID(int lpid);
extern int get_assigned_post_office_LID(int lpid);
extern int get_assigned_post_office_GID(int lpid);
//DRIVER STUFF -----------------------------
extern void mailbox_init(mailbox_state *s, tw_lp *lp);
extern void mailbox_prerun(mailbox_state *s, tw_lp *lp);
extern void mailbox_event_handler(mailbox_state *s, tw_bf *bf, letter *in_msg, tw_lp *lp);
extern void mailbox_RC_event_handler(mailbox_state *s, tw_bf *bf, letter *in_msg, tw_lp *lp);
extern void mailbox_final(mailbox_state *s, tw_lp *lp);
extern void mailbox_commit(mailbox_state *s, tw_bf *bf, letter *m, tw_lp *lp);
extern void post_office_init(post_office_state *s, tw_lp *lp);
extern void post_office_prerun(post_office_state *s, tw_lp *lp);
extern void post_office_event_handler(post_office_state *s, tw_bf *bf, letter *in_msg, tw_lp *lp);
extern void post_office_RC_event_handler(post_office_state *s, tw_bf *bf, letter *in_msg, tw_lp *lp);
extern void post_office_final(post_office_state *s, tw_lp *lp);
extern void post_office_commit(post_office_state *s, tw_bf *bf, letter *m, tw_lp *lp);
//MAIN STUFF-----------------------------
extern tw_lptype model_lps[];
tw_stime lookahead;
unsigned int nlp_per_pe;
unsigned int custom_LPs_per_pe;
int total_mailboxes;
int total_post_offices;
#endif