1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
/*
* Copyright (c) 2017 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file cpi_NameRouteProtocolType.h
* @brief Specifies the reason for or creator of a route (i.e. the protocol that created the route)
*
* A LOCAL route points to an application running on the localhost.
*
* A CONNECTED route exists because the described destination is directly connected to the localhost. For
* example, a route to a link local network name would be CONNECTED.
*
* A STATIC route is administratively created, such as via the "metis_control" program or via the
* configuration file.
*
* An ACORN route is dynamically created by the ACRON routing protocol.
*
*/
#ifndef libccnx_cpi_NameRouteProtocolType_h
#define libccnx_cpi_NameRouteProtocolType_h
/**
* @typedef CPINameRouteProtocolType
* @abstract Enumerates the protocol that created a route
* @constant cpiNameRouteProtocolType_LOCAL An application running on the localhost
* @constant cpiNameRouteProtocolType_CONNECTED A directly connected destination
* @constant cpiNameRouteProtocolType_STATIC Administratively created
* @constant cpiNameRouteProtocolType_ACORN The ACORN routing protocol
*/
typedef enum {
cpiNameRouteProtocolType_LOCAL = 0, // local face to app
cpiNameRouteProtocolType_CONNECTED = 1, // directly connected network
cpiNameRouteProtocolType_STATIC = 2, // administrative static route
cpiNameRouteProtocolType_ACORN = 20
} CPINameRouteProtocolType;
/**
* Return the string representation of the specified `CPINameRouteProtocolType`.
*
* The returned string does not need to be freed.
*
* @param [in] type The type to represent as a string.
*
* @return The string representation of the specified 'CPINameRouteProtocolType'.
*
* Example:
* @code
* {
* CPINameRouteProtocolType type = ROUTE_PROTO_CONNECTED;
*
* char *name = cpiNameRouteProtocolType_ToString(type);
*
* printf("NameRouteProtocolType is %s\n", name);
* }
* @endcode
*
* @see cpiNameRouteProtocolType_FromString
*/
const char *cpiNameRouteProtocolType_ToString(CPINameRouteProtocolType type);
/**
* Given a string describing a `CPINameRouteProtocolType`, return the matching `CPINameRouteProtocolType`.
*
* If an invalid string is specified, the program will terminate with an IllegalValue exception.
* Possible values are: "LOCAL", "CONNECTED", "STATIC", and "ACORN".
*
* @param [in] str A pointer to a string representation of the desired `CPINameRouteProtocolType`.
*
* @return The `CPINameRouteProtocolType` matching the specified string.
*
* Example:
* @code
* {
* CPINameRouteProtocolType type = cpiNameRouteProtocolType_FromString("STATIC");
* }
* @endcode
*
* @see cpiNameRouteProtocolType_ToString
*/
CPINameRouteProtocolType cpiNameRouteProtocolType_FromString(const char *str);
#endif // libccnx_cpi_NameRouteProtocolType_h
|