HDLC-Daemon
HdlcdSessionDescriptor.h
Go to the documentation of this file.
1 
39 #ifndef HDLCD_SESSION_DESCRIPTOR_H
40 #define HDLCD_SESSION_DESCRIPTOR_H
41 
42 #include <stdint.h>
43 
49 typedef enum {
55 
56  // Book keeping
61 
62 
63 
70 typedef enum {
76 
77  // Book keeping
80 
81 
82 
90 public:
98  HdlcdSessionDescriptor(E_SESSION_TYPE a_eSessionType, uint8_t a_SessionFlags): m_ServiceAccessPointSpecifier(a_eSessionType | a_SessionFlags) {
99  // Checks
100  if (((a_eSessionType & SESSION_TYPE_MASK) >= SESSION_TYPE_ARITHMETIC_ENDMARKER) ||
101  (a_eSessionType & ~SESSION_TYPE_MASK)) {
102  // Invalid session type
103  m_ServiceAccessPointSpecifier = SESSION_TYPE_UNSET;
104  } // if
105 
106  if (a_SessionFlags & ~SESSION_FLAGS_MASK) {
107  // Invalid flags
108  m_ServiceAccessPointSpecifier = SESSION_TYPE_UNSET;
109  } // if
110  }
111 
118  explicit HdlcdSessionDescriptor(uint8_t a_ServiceAccessPointSpecifier): m_ServiceAccessPointSpecifier(a_ServiceAccessPointSpecifier) {
119  // Checks
120  if ((m_ServiceAccessPointSpecifier & SESSION_TYPE_MASK) >= SESSION_TYPE_ARITHMETIC_ENDMARKER) {
121  // Invalid session type
122  m_ServiceAccessPointSpecifier = SESSION_TYPE_UNSET;
123  } // if
124  }
125 
130  operator uint8_t() const {
131  return m_ServiceAccessPointSpecifier;
132  }
133 
139  return E_SESSION_TYPE(m_ServiceAccessPointSpecifier & SESSION_TYPE_MASK);
140  }
141 
148  bool DeliversRcvdData() const {
149  return (m_ServiceAccessPointSpecifier & SESSION_FLAGS_DELIVER_RCVD);
150  }
151 
158  bool DeliversSentData() const {
159  return (m_ServiceAccessPointSpecifier & SESSION_FLAGS_DELIVER_SENT);
160  }
161 
168  bool DeliversInvalidData() const {
169  return (m_ServiceAccessPointSpecifier & SESSION_FLAGS_DELIVER_INVALIDS);
170  }
171 
172 private:
173  // Internal members
174  uint8_t m_ServiceAccessPointSpecifier;
175 };
176 
177 #endif // HDLCD_SESSION_DESCRIPTOR_H
Deliver data packets sent by the HDLCd and received by the device.
Payload Raw, data read only, port status read only.
Empty list of flags.
HdlcdSessionDescriptor(E_SESSION_TYPE a_eSessionType, uint8_t a_SessionFlags)
The constructor of HdlcdSessionDescriptor objects.
Deliver data packets sent by the device and received by the HDLCd.
bool DeliversRcvdData() const
Query whether data packets sent by a device to the HDLCd should be delivered.
Payload, data read and write, port status read and write.
E_SESSION_FLAGS
The enum E_SESSION_FLAGS to specify all possible session flags.
E_SESSION_TYPE
The enum E_SESSION_TYPE to specify all possible session types.
bool DeliversSentData() const
Query whether data packets sent by the HDLCd to a device should be delivered.
Port status only, no data exchange, port status read and write.
HDLC Raw, data read only, port status read only.
E_SESSION_TYPE GetSessionType() const
Query the session type.
The lowest invalid session type number.
Deliver also invalid frames with broken CRC checksum.
HDLC dissected, data read only, port status read only.
HdlcdSessionDescriptor(uint8_t a_ServiceAccessPointSpecifier)
The constructor of HdlcdSessionDescriptor objects.
bool DeliversInvalidData() const
Query whether invalid data packets with a broken CRC checksum should be delivered.
Bit mask to query the session flags.
Invalid entry, to indicate unset state.
Bit mask to query the session type.
Class HdlcdSessionDescriptor.