lp-msg.h 904 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
/*
 * Copyright (C) 2014 University of Chicago.
 * See COPYRIGHT notice in top-level directory.
 *
*/

#ifndef LP_MSG_H
#define LP_MSG_H

Jonathan Jenkins's avatar
Jonathan Jenkins committed
10 11 12 13
#ifdef __cplusplus
extern "C" {
#endif

14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#include "ross.h"

/* It is good practice to always include the src LPID, a unique message
 * identifier, and a "magic" number to ensure that the LP type receiving the
 * message is the intended recipient. This is formalized in the following
 * struct and is used in a few places where LP-to-LP communication is
 * abstracted */

typedef struct msg_header_s {
    tw_lpid src;
    int event_type;
    int magic; 
} msg_header;

/* data structure utilities */
void msg_set_header(int magic, int event_type, tw_lpid src, msg_header *h);

Jonathan Jenkins's avatar
Jonathan Jenkins committed
31 32 33 34
#ifdef __cplusplus
}
#endif

35 36 37 38 39 40 41 42 43 44
#endif /* end of include guard: LP_MSG_H */

/*
 * Local variables:
 *  c-indent-level: 4
 *  c-basic-offset: 4
 * End:
 *
 * vim: ts=8 sts=4 sw=4 expandtab
 */