ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CpacketV1.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CpacketV1.C
1 /*
2 ** CpacketV1.C
3 **
4 ** Author: $Author: purschke $
5 ** Date: $Date: 2000/07/21 01:51:10 $
6 **
7 ** $Log: CpacketV1.C,v $
8 ** Revision 1.1.1.1 2000/07/21 01:51:10 purschke
9 ** mlp -- adding the new automakified "basic" module to CVS.
10 **
11 **
12 ** Revision 1.4 1999/07/12 14:23:37 phoncs
13 ** (stephen markacs) added endianism setting to makePacketV1Hdr() in CpacketV1.C
14 **
15 ** Revision 1.3 1998/12/11 22:01:59 markacs
16 ** (stephen markacs) adding log into cvs tags
17 **
18 */
19 /*
20 ** These are the Version 1 routines to provide
21 ** information from and acces to the fields in the
22 ** packet header. The inlined routines are
23 ** contained in CpacketV1.h.
24 **
25 */
26 #include "phenixOnline.h"
27 #include "Cpacket.h"
28 #include "CpacketV1.h"
29 
30 VALUE_ret makePacketV1Hdr (PHDWORD* packet_ptr, UINT maxPacketLength)
31 {
32  if (maxPacketLength < packetV1HdrLength)
33  return valueFailure;
34 
35  dwordClear(packet_ptr, packetV1HdrLength);
39 
40  unsigned long n = 1;
41  char * cp = (char*)&n;
42  if (*cp==1) setPacketEndianism(packet_ptr, 1);
43  else setPacketEndianism(packet_ptr, 2);
44 
45  return packetV1HdrLength;
46 }
47 
48 /*
49 ** Return a pointer to the debug block.
50 */
52 {
53  return (packet_ptr + getPacketLength(packet_ptr) -
54  getPacketV1DebugLength(packet_ptr) - getPacketV1ErrorLength(packet_ptr) );
55 }
56 
57 /*
58 ** Return a pointer to the error block.
59 */
61 {
62  return (packet_ptr + getPacketLength(packet_ptr) -
63  getPacketV1ErrorLength(packet_ptr));
64 }
65 
67 {
68  return packet_ptr + getPacketHdrLength(packet_ptr);
69 }
70 
72 {
73  return findPacketV1DebugStart(packet_ptr) - 1;
74 }
75 
76 
77 /*
78 ** Check for a valid V1 header. Currently this test only checks the
79 ** length to make sure its consistent with the expected length.
80 **
81 */
83 {
84  if (getPacketHdrLength(packet_ptr) == packetV1HdrLength) {
86  return TRUE;
87  }
88  else {
90  return FALSE;
91  }
92 }
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107