common-net.h 2.43 KB
Newer Older
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
#ifndef COMMON_NET_H
#define COMMON_NET_H
#include "codes/model-net-lp.h"
#include "codes/quickhash.h"

#ifdef __cplusplus
extern "C" {
#endif


struct mn_hash_key
{
  uint64_t message_id;
  tw_lpid sender_id;
};

struct mn_qhash_entry
{
  struct mn_hash_key key;
  char * remote_event_data;
  int num_chunks;
  int remote_event_size;
  struct qhash_head hash_link;
};

extern int mn_rank_hash_compare(void *key, struct qhash_head *link);

extern int mn_hash_func(void *k, int table_size);

extern void free_tmp(void * ptr);

typedef struct message_list message_list;

struct message_list {
35
  //CHANGE: add message types for new networks here
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
  union {
    terminal_message dfly_msg;
    em_message em_msg;
  };
  char* event_data;
  message_list *next;
  message_list *prev;
  int port, index;
  message_list *altq_next, *altq_prev;
  int in_alt_q, altq_port;
};

extern void append_to_message_list(  
    message_list ** thisq,
    message_list ** thistail,
    int index, 
    message_list *msg);

extern void prepend_to_message_list(  
    message_list ** thisq,
    message_list ** thistail,
    int index, 
    message_list *msg);

extern message_list* return_head(
    message_list ** thisq,
    message_list ** thistail,
    int index);

extern message_list* return_tail(
    message_list ** thisq,
    message_list ** thistail,
    int index);

extern void delete_from_message_list(
    message_list *** allq, 
    message_list *** alltail,
    message_list *msg);

extern void add_to_message_list(
    message_list *** allq, 
    message_list *** alltail,
    message_list *msg);

extern void altq_append_to_message_list(  
    message_list ** thisq,
    message_list ** thistail,
    int index, 
    message_list *msg);

extern void altq_prepend_to_message_list(  
    message_list ** thisq,
    message_list ** thistail,
    int index, 
    message_list *msg);

extern message_list* altq_return_head(
    message_list ** thisq,
    message_list ** thistail,
    int index);

extern message_list* altq_return_tail(
    message_list ** thisq,
    message_list ** thistail,
    int index);

extern void altq_delete_from_message_list(
    message_list *** allq, 
    message_list *** alltail,
    message_list *msg);

extern void altq_add_to_message_list(
    message_list *** allq, 
    message_list *** alltail,
    message_list *msg);

extern void delete_message_list(void *thism);
extern tw_stime bytes_to_ns(uint64_t bytes, double GB_p_s);

#ifdef __cplusplus
}
#endif

#endif