libdoip  0.1.0
DoIP (Diagnostics over Internet Protocol) ISO 13400 C++17 Library
DoIPServerState.h
Go to the documentation of this file.
1 #ifndef DOIPSTATE_H
2 #define DOIPSTATE_H
3 
4 #include <iostream>
5 
6 namespace doip {
7 // DoIP Protocol States
8 // Figure 26
9 enum class DoIPServerState {
10  SocketInitialized, // Initial state after socket creation
11  WaitRoutingActivation, // Waiting for routing activation request
12  RoutingActivated, // Routing is active, ready for diagnostics
13  WaitAliveCheckResponse, // D& config Waiting for alive check response
14  WaitDownstreamResponse, // Waiting for response from downstream device
15  Finalize, // Cleanup state
16  Closed // Connection closed
17 };
18 
19 // Stream operator for DoIPServerState
20 inline std::ostream &operator<<(std::ostream &os, DoIPServerState state) {
21  switch (state) {
23  return os << "SocketInitialized";
25  return os << "WaitRoutingActivation";
27  return os << "RoutingActivated";
29  return os << "WaitAliveCheckResponse";
31  return os << "WaitDownstreamResponse";
33  return os << "Finalize";
35  return os << "Closed";
36  default:
37  return os << "Unknown(" << static_cast<int>(state) << ")";
38  }
39 }
40 
41 } // namespace doip
42 
43 #endif /* DOIPSTATE_H */
Definition: AnsiColors.h:3
DoIPServerState
std::ostream & operator<<(std::ostream &os, const ByteArray &arr)
Stream operator for ByteArray.
Definition: ByteArray.h:303