1 /* BEGIN INCLUDE FILE ... mseg_segment.incl.pl1 */
 2 /* Created:  April 1985 by G. Palter from msg_hdr.incl.pl1 */
 3 
 4 /* format: style3,linecom */
 5 
 6 /* NOTE: This include file references the mseg_wakeup_state structure which is defined separately in
 7    mseg_wakeup_state.incl.pl1.  Programs which use this include file must also include mseg_wakeup_state.incl.pl1 to
 8    prevent compilation errors. */
 9 
10 
11 /* Definition of the structure of a message segment --
12 
13    A message segment is composed of three sections -- the header, the block map, and the blocks space.
14 
15    In addition to the message ID hash table and the head&tail of the chronological message chain, the message header also
16    contains the state of wakeup acceptance for this segment.  In order to maintain compatibility with early version 5
17    message segments, the wakeup state is maintained in a 64 word area of the header which had been known as the "header
18    message".  See mseg_wakeup_state.incl.pl1 for additional information.
19 
20    The entire message segment, including the header and block map, is treated as an array of fixed size blocks.  The block
21    map contains a bit for each block in the message which indicates whether that block is in use.  (The blocks which
22    overlay the header and block map are always marked as being in use).  The size of the block map is based on the
23    maxlength of the message segment in order to provide more free space in very small message segments.
24 
25    When a message is added to a message segment, its content is split into blocks which are allocated in the blocks space.
26    The blocks space starts with the first block after the block map and occupies the remainder of the segment. */
27 
28 declare   1 mseg_segment      aligned based (mseg_ptr),
29             2 header          aligned,
30               3 lock          bit (36) aligned,
31               3 sentinel      bit (36) aligned,             /* proves that this segment is a message segment */
32               3 reserved      bit (72) aligned,             /* ... for compatibility with early version 5 segments */
33               3 date_time_last_salvaged
34                               fixed binary (71),
35               3 pad           (2) bit (36) aligned,
36               3 message_chain,                              /* the chronological chain of messages in the segment ... */
37                 4 first_message                             /* ... the first (oldest) message */
38                               fixed binary (18) unaligned unsigned,
39                 4 pad1        bit (18) unaligned,
40                 4 last_message                              /* ... the last (youngest) message */
41                               fixed binary (18) unaligned unsigned,
42                 4 pad2        bit (18) unaligned,
43               3 n_blocks_allocated                          /* total # of blocks available in this message segment ... */
44                               fixed binary (18),            /* ... including space occupied by the header and block map */
45               3 n_blocks_unused
46                               fixed binary (18),
47               3 n_messages    fixed binary (18),
48               3 block_size    fixed binary,                 /* ... in words */
49               3 flags,
50                 4 modification_in_progress
51                               bit (1) unaligned,
52                 4 salvaged    bit (1) unaligned,            /* ON => the message segment had been salvaged earlier */
53                 4 wakeup_state_set
54                               bit (1) unaligned,
55                 4 salvage_in_progress
56                               bit (1) unaligned,
57                 4 pad         bit (32) unaligned,
58               3 version       fixed binary,
59               3 wakeup_state  aligned,
60                 4 state       aligned like mseg_wakeup_state,
61                 4 pad         (64 - 10) bit (36) aligned,   /* ... for compatibility with early version 5 segments */
62               3 hash_table    aligned,                      /* ... based on the low order 9 bits of the message ID */
63                 4 last_message
64                               (0:511) fixed binary (18) unaligned unsigned,
65             2 block_map       aligned,                      /* ON => the block is in use */
66               3 map           bit (0 refer (mseg_segment.n_blocks_allocated)) unaligned;
67 
68 declare   mseg_ptr            pointer;
69 
70 declare   MSEG_SEGMENT_VERSION_5                            /* presently supported version */
71                               fixed binary static options (constant) initial (5);
72 
73 declare   MSEG_SEGMENT_SENTINEL
74                               bit (36) aligned static options (constant) initial ("252525252525"b3);
75 
76 
77 /* Redefinitions required to access the wakeup_state of the segment in early version 5 message segments */
78 
79 declare   header_msg_access_class
80                               bit (72) aligned defined (mseg_segment.reserved);
81 
82 declare   header_msg_present  bit (1) unaligned defined (mseg_segment.wakeup_state_set);
83 
84 declare   header_msg          (64) bit (36) aligned based (addr (mseg_segment.wakeup_state));
85 
86 /* END INCLUDE FILE ... mseg_segment.incl.pl1 */