libdoip
0.1.0
DoIP (Diagnostics over Internet Protocol) ISO 13400 C++17 Library
DoIPRoutingActivationResult.h
Go to the documentation of this file.
1
#ifndef DOIPROUTINGACTIVATIONRESULT_H
2
#define DOIPROUTINGACTIVATIONRESULT_H
3
4
namespace
doip
{
5
6
// Table 56 - Routing activation response codes
7
enum class
DoIPRoutingActivationResult
: uint8_t{
8
UnknownSourceAddress
= 0x00,
// close socket
9
NoMoreRoutingSlotsAvailable
= 0x01,
// no more routing slots available, close socket
10
InvalidAddressOrRoutingType
= 0x02,
// Source address or routing type differ from already registered one
11
SourceAddressAlreadyRegistered
= 0x03,
// source address already registered, close socket
12
Unauthorized
= 0x04,
// unauthorized source address, do not activate routing but keep socket open
13
MissingConfirmation
= 0x05,
// missing confirmation, close socket
14
InvalidRoutingType
= 0x06,
// invalid routing type, close socket
15
SecuredConnectionRequired
= 0x07,
// secured connection (TLS) required, close socket
16
VehicleNotReadyForRouting
= 0x08,
// vehicle not ready for routing (e. g. pending update), do not activate routing but keep socket open
17
// 0x09: reserved
18
RouteActivated
= 0x10,
// routing activated successfully
19
RouteActivatedConfirmationRequired
= 0x11
// routing activated successfully but requires confirmation (optional)
20
};
21
22
/**
23
* @brief Check if the socket should be closed based on the routing activation result.
24
*
25
* @param result the routing activation result code
26
* @return true if the socket should be closed, false otherwise
27
*/
28
inline
bool
closeSocketOnRoutingActivationResult
(
DoIPRoutingActivationResult
result) {
29
switch
(result) {
30
case
DoIPRoutingActivationResult::UnknownSourceAddress
:
31
case
DoIPRoutingActivationResult::NoMoreRoutingSlotsAvailable
:
32
case
DoIPRoutingActivationResult::SourceAddressAlreadyRegistered
:
33
case
DoIPRoutingActivationResult::MissingConfirmation
:
34
case
DoIPRoutingActivationResult::InvalidRoutingType
:
35
case
DoIPRoutingActivationResult::SecuredConnectionRequired
:
36
return
true
;
37
case
DoIPRoutingActivationResult::InvalidAddressOrRoutingType
:
38
case
DoIPRoutingActivationResult::Unauthorized
:
39
case
DoIPRoutingActivationResult::VehicleNotReadyForRouting
:
40
case
DoIPRoutingActivationResult::RouteActivated
:
41
case
DoIPRoutingActivationResult::RouteActivatedConfirmationRequired
:
42
return
false
;
43
default
:
44
return
true
;
// unknown code, be safe and close socket
45
}
46
}
47
48
inline
std::ostream&
operator<<
(std::ostream& os,
DoIPRoutingActivationResult
result) {
49
switch
(result) {
50
case
DoIPRoutingActivationResult::UnknownSourceAddress
:
51
return
os <<
"UnknownSourceAddress"
;
52
case
DoIPRoutingActivationResult::NoMoreRoutingSlotsAvailable
:
53
return
os <<
"NoMoreRoutingSlotsAvailable"
;
54
case
DoIPRoutingActivationResult::InvalidAddressOrRoutingType
:
55
return
os <<
"InvalidAddressOrRoutingType"
;
56
case
DoIPRoutingActivationResult::SourceAddressAlreadyRegistered
:
57
return
os <<
"SourceAddressAlreadyRegistered"
;
58
case
DoIPRoutingActivationResult::Unauthorized
:
59
return
os <<
"Unauthorized"
;
60
case
DoIPRoutingActivationResult::MissingConfirmation
:
61
return
os <<
"MissingConfirmation"
;
62
case
DoIPRoutingActivationResult::InvalidRoutingType
:
63
return
os <<
"InvalidRoutingType"
;
64
case
DoIPRoutingActivationResult::SecuredConnectionRequired
:
65
return
os <<
"SecuredConnectionRequired"
;
66
case
DoIPRoutingActivationResult::VehicleNotReadyForRouting
:
67
return
os <<
"VehicleNotReadyForRouting"
;
68
case
DoIPRoutingActivationResult::RouteActivated
:
69
return
os <<
"RouteActivated"
;
70
case
DoIPRoutingActivationResult::RouteActivatedConfirmationRequired
:
71
return
os <<
"RouteActivatedConfirmationRequired"
;
72
default
:
73
return
os <<
"Unknown("
<<
static_cast<
int
>
(result) <<
")"
;
74
}
75
}
76
77
}
// namespace doip
78
79
#endif
/* DOIPROUTINGACTIVATIONRESULT_H */
doip
Definition:
AnsiColors.h:3
doip::DoIPRoutingActivationResult
DoIPRoutingActivationResult
Definition:
DoIPRoutingActivationResult.h:7
doip::DoIPRoutingActivationResult::InvalidAddressOrRoutingType
@ InvalidAddressOrRoutingType
doip::DoIPRoutingActivationResult::RouteActivated
@ RouteActivated
doip::DoIPRoutingActivationResult::InvalidRoutingType
@ InvalidRoutingType
doip::DoIPRoutingActivationResult::UnknownSourceAddress
@ UnknownSourceAddress
doip::DoIPRoutingActivationResult::SourceAddressAlreadyRegistered
@ SourceAddressAlreadyRegistered
doip::DoIPRoutingActivationResult::RouteActivatedConfirmationRequired
@ RouteActivatedConfirmationRequired
doip::DoIPRoutingActivationResult::VehicleNotReadyForRouting
@ VehicleNotReadyForRouting
doip::DoIPRoutingActivationResult::Unauthorized
@ Unauthorized
doip::DoIPRoutingActivationResult::NoMoreRoutingSlotsAvailable
@ NoMoreRoutingSlotsAvailable
doip::DoIPRoutingActivationResult::SecuredConnectionRequired
@ SecuredConnectionRequired
doip::DoIPRoutingActivationResult::MissingConfirmation
@ MissingConfirmation
doip::operator<<
std::ostream & operator<<(std::ostream &os, const ByteArray &arr)
Stream operator for ByteArray.
Definition:
ByteArray.h:303
doip::closeSocketOnRoutingActivationResult
bool closeSocketOnRoutingActivationResult(DoIPRoutingActivationResult result)
Check if the socket should be closed based on the routing activation result.
Definition:
DoIPRoutingActivationResult.h:28
inc
DoIPRoutingActivationResult.h
Generated by
1.9.1