1 /*
2  * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
3  *
4  * This software may be freely used, copied, modified, and distributed
5  * provided that the above copyright notice is preserved in all copies of the
6  * software.
7  */
8 
9 /* -*-C-*-
10  *
11  * $Revision: 1.3 $
12  *     $Date: 2004/12/27 14:00:54 $
13  *
14  *
15  *   Project: ANGEL
16  *
17  *     Title: Private header for channels implementations
18  */
19 
20 #ifndef angel_chanpriv_h
21 #define angel_chanpriv_h
22 
23 /*
24  * This describes the internal structure and flags for a channels packet.
25  */
26 
27 /* byte positions within channel packet */
28 #define CF_CHANNEL_BYTE_POS  0
29 #define CF_HOME_SEQ_BYTE_POS 1
30 #define CF_OPPO_SEQ_BYTE_POS 2
31 #define CF_FLAGS_BYTE_POS    3
32 #define CF_DATA_BYTE_POS     4
33 
34 /* flags for FLAGS field */
35 #define CF_RELIABLE  (1 << 0)    /* use reliable channels protocol */
36 #define CF_RESEND    (1 << 1)    /* this is a renegotiation packet */
37 #define CF_HEARTBEAT (1 << 2)    /* heartbeat packet - prod target into sync */
38 
39 /* byte positions within buffer */
40 #define CB_LINK_BYTE_POS        0   /* the link pointer */
41 #define CB_CHAN_HEADER_BYTE_POS 4   /* the channel frame starts here */
42 
43 /* macro to get buffer position of packet component */
44 #define CB_PACKET(x) (CB_CHAN_HEADER_BYTE_POS + (x))
45 
46 /* byte offset of packet data within buffer */
47 #define CB_CHAN_DATA_BYTE_POS   (CB_PACKET(CF_DATA_BYTE_POS))
48 
49 /* access the link in a buffer, where b is byte pointer to buffer */
50 #define CB_LINK(b) ((p_Buffer)(&(b)[0]))
51 
52 #define invalidChannelID(chan)  (((int)(chan)) < 0 || \
53                                  (chan) >= CI_NUM_CHANNELS)
54 
55 #endif /* ndef angel_chanpriv_h */
56 
57 /* EOF chanpriv.h */
58