![]() |
TRIP Routing Daemon
TRIP (RFC 3219) Location Server Implementation
|
Protocol definition header. More...
#include <stdint.h>#include <stddef.h>

Go to the source code of this file.
Macros | |
| #define | MAX_MSG_SIZE 4096 |
| #define | PROTOCOL_VERSION 1 |
| current protocol version | |
| #define | CAPINFO_TRANS_NULL (uint32_t)-1 |
| Capability information NULL transmission mode value. | |
| #define | IS_ATTR_FLAG_WELL_KNOWN(x) |
| Message UPDATE. | |
| #define | IS_ATTR_FLAG_TRANSITIVE(x) |
| #define | IS_ATTR_FLAG_DEPENDENT(x) |
| #define | IS_ATTR_FLAG_PARTIAL(x) |
| #define | IS_ATTR_FLAG_LSENCAP(x) |
| #define | ATTR_FLAG_WELL_KNOWN 0b00000001 |
| #define | ATTR_FLAG_TRANSITIVE 0b00000010 |
| #define | ATTR_FLAG_DEPENDENT 0b00000100 |
| #define | ATTR_FLAG_PARTIAL 0b00001000 |
| #define | ATTR_FLAG_LSENCAP 0b00010000 |
| #define | COMMUNITY_NO_EXPORT ((community_t){ 0x00000000, 0xffffff01 }) |
| Community value no-export. | |
| #define | TIMER_CONNECT_RETRY 120 |
| #define | TIMER_HOLD_TIME 90 |
| #define | TIMER_KEEPALIVE 30 |
| #define | TIMER_MAX_PURGE_TIME 10 |
| #define | TIMER_DISABLE_TIME 180 |
| #define | TIMER_MIN_ITAD_ORIG_INT 30 |
| #define | TIMER_MIN_ROUTE_ADVERT_INT 30 |
| #define | PROTO_TCP_PORT 6069 |
| TCP port as defined by RFC 3219. | |
| #define | PROTO_TRY(o, res, a) |
| Try-Catch macro for serialization/deserialization functions. | |
Typedefs | |
| typedef uint32_t | capinfo_transmode_t |
| Capability information transmission mode. | |
| typedef route_t | attr_withdrawnroutes_t[] |
| Attribute WithdrawnRoutes. | |
| typedef route_t | attr_reachableroutes_t[] |
| Attribute ReachableRoutes. | |
| typedef itadpath_t | attr_advertisementpath_t |
| Attribute AdvertisementPath. | |
| typedef itadpath_t | attr_routedpath_t |
| Attribute RoutedPath. | |
| typedef void | attr_atomicaggregate_t |
| Attribute AtomicAggregate. | |
| typedef uint32_t | attr_localpref_t |
| Attribute LocalPreference. | |
| typedef uint32_t | attr_multiexitdisc_t |
| Attribute MultiExitDiscriminator. | |
| typedef community_t | attr_communities_t[] |
| Attribute Communities. | |
| typedef uint32_t | attr_itadtopology_t[] |
| Attribute ITAD Topology. | |
| typedef void | attr_convertedroute_t |
| Attribute ConvertedRoute. | |
| typedef void | msg_keepalive_t |
| Message KEEPALIVE. | |
| typedef enum runtime_errors_e | runtime_error_t |
| Serialization/deserialization runtime errors. | |
Enumerations | |
| enum | msg_type { MSG_TYPE_OPEN = 1 , MSG_TYPE_UPDATE , MSG_TYPE_NOTIFICATION , MSG_TYPE_KEEPALIVE } |
| Message types. | |
| enum | open_opt_type { OPEN_OPT_TYPE_CAPABILITY_INFO = 1 } |
| Message OPEN optional parameter types. | |
| enum | capinfo_code { CAPINFO_CODE_ROUTETYPE = 1 , CAPINFO_CODE_TRANSMODE } |
| Capability information option types. | |
| enum | capinfo_transmode { CAPINFO_TRANS_SEND_RECV = 1 , CAPINFO_TRANS_SEND , CAPINFO_TRANS_RECV } |
| Capability information transmission mode types. | |
| enum | attr_type { ATTR_TYPE_WITHDRAWNROUTES = 1 , ATTR_TYPE_REACHABLEROUTES , ATTR_TYPE_NEXTHOPSERVER , ATTR_TYPE_ADVERTISEMENTPATH , ATTR_TYPE_ROUTEDPATH , ATTR_TYPE_ATOMICAGGREGATE , ATTR_TYPE_LOCALPREFERENCE , ATTR_TYPE_MULTIEXITDISC , ATTR_TYPE_COMMUNITIES , ATTR_TYPE_ITADTOPOLOGY , ATTR_TYPE_CONVERTEDROUTE , ATTR_TYPE_RESOURCEPRIORITY , ATTR_TYPE_TOTALCIRCUITCAPACITY , ATTR_TYPE_AVAILABLECIRCUITS , ATTR_TYPE_CALLSUCCESS , ATTR_TYPE_E164PREFIX , ATTR_TYPE_PENTADECPREFIX , ATTR_TYPE_DECIMALPREFIX , ATTR_TYPE_TRUNKGROUP , ATTR_TYPE_CARRIER } |
| UPDATE attribute types. More... | |
| enum | af { AF_DECIMAL = 1 , AF_PENTADECIMAL , AF_E164 , AF_TRUNKGROUP , AF_CARRIER } |
| Address families. | |
| enum | app_proto { APP_PROTO_SIP = 1 , APP_PROTO_H323_225_0_Q931 , APP_PROTO_H323_225_0_RAS , APP_PROTO_H323_225_0_ANNEXG , APP_PROTO_IAX2 = 32768 } |
| Application protocols. More... | |
| enum | itadpath_type { ITADPATH_TYPE_AP_SET = 1 , ITADPATH_TYPE_AP_SEQUENCE } |
| ITAD path types. | |
| enum | notif_code { NOTIF_CODE_ERROR_MSG = 1 , NOTIF_CODE_ERROR_OPEN , NOTIF_CODE_ERROR_UPDATE , NOTIF_CODE_ERROR_EXPIRED , NOTIF_CODE_ERROR_STATE , NOTIF_CODE_CEASE } |
| NOTIFICATION error code. | |
| enum | notif_subcode_msg { NOTIF_SUBCODE_MSG_BAD_LEN = 1 , NOTIF_SUBCODE_MSG_BAD_TYPE } |
| NOTIFICATION error subcode for message. | |
| enum | notif_subcode_open { NOTIF_SUBCODE_OPEN_UNSUP_VERSION = 1 , NOTIF_SUBCODE_OPEN_BAD_ITAD , NOTIF_SUBCODE_OPEN_BAD_ID , NOTIF_SUBCODE_OPEN_UNSUP_OPT , NOTIF_SUBCODE_OPEN_BAD_HOLD , NOTIF_SUBCODE_OPEN_UNSUP_CAP , NOTIF_SUBCODE_OPEN_CAP_MISMATCH } |
| NOTIFICATION error subcode for OPEN. | |
| enum | notif_subcode_update { NOTIF_SUBCODE_UPDATE_MALFORM_ATTR = 1 , NOTIF_SUBCODE_UPDATE_UNK_WELLKNOWN_ATTR , NOTIF_SUBCODE_UPDATE_MISS_WELLKNOWN_ATTR , NOTIF_SUBCODE_UPDATE_BAD_ATTR_FLAG , NOTIF_SUBCODE_UPDATE_BAD_ATTR_LEN , NOTIF_SUBCODE_UPDATE_INVAL_ATTR } |
| NOTIFICATION error subcode for UPDATE. | |
| enum | runtime_errors_e { ERROR_BUFF = -1 , ERROR_BUFFLEN = -2 , ERROR_HOLD = -3 , ERROR_ITAD = -4 , ERROR_NOTIF_ERROR_CODE = -5 , ERROR_NOTIF_ERROR_SUBCODE = -6 , ERROR_INCOMPLETE = -7 , ERROR_MSGTYPE = -8 , ERROR_VERSION = -9 , ERROR_OPT = -10 , ERROR_CAPINFO_CODE = -11 , ERROR_AF = -12 , ERROR_APP_PROTO = -13 , ERROR_TRANS = -14 , ERROR_ATTR_TYPE = -15 , ERROR_ATTR_FLAG_WELL_KNOWN = -16 , ERROR_ATTR_FLAG_LSENCAP = -17 , ERROR_ITADPATH_TYPE = -18 , ERROR_COMMUNITY_ITAD = -19 } |
| Serialization/deserialization runtime errors. More... | |
Functions | |
| struct | __attribute__ ((packed)) |
| Message header. | |
| const char * | app_proto_str (int app_proto) |
| Application protocol to string. | |
| runtime_error_t | new_msg_open (void *buff, size_t len, uint16_t hold, uint32_t itad, uint32_t id, const capinfo_routetype_t *capinfo_routetypes, size_t routetypes_size, capinfo_transmode_t capinfo_transmode) |
| Serialize OPEN message. | |
| runtime_error_t | new_msg_update (void *buff, size_t len, const msg_update_attr_t **attrs, size_t attrs_size) |
| Serialize UPDATE message. | |
| runtime_error_t | new_msg_keepalive (void *buff, size_t len) |
| Serialize KEEPALIVE message. | |
| runtime_error_t | new_msg_notif (void *buff, size_t len, uint8_t error_code, uint8_t error_subcode, size_t datalen, const void *data) |
| Serialize NOTIFICATION message. | |
| runtime_error_t | new_attr_withdrawnroutes (void *buff, size_t len, int lsencap, uint32_t id, uint32_t seq, const route_t **routes, size_t routes_size) |
| Serialize WithdrawnRoutes attribute. | |
| runtime_error_t | new_attr_reachableroutes (void *buff, size_t len, int lsencap, uint32_t id, uint32_t seq, const route_t **routes, size_t routes_size) |
| Serialize ReachableRoutes attribute. | |
| runtime_error_t | new_attr_nexthopserver (void *buff, size_t len, uint32_t next_itad, const char *server) |
| Serialize NextHopServer attribute. | |
| runtime_error_t | new_attr_advertisementpath (void *buff, size_t len, const itadpath_t *path) |
| Serialize AdvertisementPath attribute. | |
| runtime_error_t | new_attr_routedpath (void *buff, size_t len, const itadpath_t *path) |
| Serialize RoutedPath attribute. | |
| runtime_error_t | new_attr_atomicaggregate (void *buff, size_t len) |
| Serialize AtomicAggregate attribute. | |
| runtime_error_t | new_attr_localpref (void *buff, size_t len, uint32_t localpref) |
| Serialize LocalPref attribute. | |
| runtime_error_t | new_attr_multiexitdisc (void *buff, size_t len, uint32_t metric) |
| Serialize MultiExitDisc attribute. | |
| runtime_error_t | new_attr_communities (void *buff, size_t len, const community_t *communities, size_t communities_size) |
| Serialize Communities attribute. | |
| runtime_error_t | new_attr_itadtopology (void *buff, size_t len, uint32_t id, uint32_t seq, const uint32_t *itads, size_t itads_size) |
| Serialize ITAD Topology attribute. | |
| runtime_error_t | new_attr_convertedroute (void *buff, size_t len) |
| Serialize ConvertedRoute attribute. | |
| runtime_error_t | parse_msg (const void *buff, size_t len, const msg_t **msg_out) |
| Deserialize message. | |
| runtime_error_t | parse_msg_open (const void *buff, size_t len, const msg_open_t **open_out) |
| Deserialize message OPEN. | |
| runtime_error_t | parse_msg_open_opt (const void *buff, size_t len, const msg_open_opt_t **opt_out) |
| Deserialize message OPEN optional parameter. | |
| runtime_error_t | parse_capinfo (const void *buff, size_t len, const capinfo_t **capinfo_out) |
| Deserialize option capability information. | |
| runtime_error_t | parse_capinfo_routetype (const void *buff, size_t len, const capinfo_routetype_t **routetype_out) |
| Deserialize option route type. | |
| runtime_error_t | parse_capinfo_transmode (const void *buff, size_t len, const capinfo_transmode_t **transmode_out) |
| Deserialize option transmission mode. | |
| runtime_error_t | parse_msg_update_attr (const void *buff, size_t len, const msg_update_attr_t **attr_out) |
| Deserialize UPDATE attribute. | |
| runtime_error_t | parse_msg_update_attr_lsencap (const void *buff, size_t len, const msg_update_attr_lsencap_t **attr_out) |
| Deserialize UPDATE link-state encapsulated attribute. | |
| runtime_error_t | parse_route (const void *buff, size_t len, const route_t **route_out) |
| Deserialize route. | |
| runtime_error_t | parse_itadpath (const void *buff, size_t len, const itadpath_t **itadpath_out) |
| Deserialize ITAD path. | |
| runtime_error_t | parse_attr_localpref (const void *buff, size_t len, const attr_localpref_t **localpref_out) |
| Deserialize LocalPreference attribute. | |
| runtime_error_t | parse_attr_multiexitdisc (const void *buff, size_t len, const attr_multiexitdisc_t **multiexitdisc_out) |
| Deserialize MultiExitDisc attribute. | |
| runtime_error_t | parse_community (const void *buff, size_t len, const community_t **community_out) |
| Deserialize Community. | |
| runtime_error_t | parse_itad (const void *buff, size_t len, const uint32_t **itad_out) |
| Deserialize ITAD. | |
| runtime_error_t | parse_msg_notif (const void *buff, size_t len, const msg_notif_t **notif_out) |
| Deserialize NOTIFICATION message. | |
| const char * | notif_code_subcode_str (int code, int subcode) |
| String NOTIFICATION code, subcode. | |
Protocol definition header.
| #define CAPINFO_TRANS_NULL (uint32_t)-1 |
Capability information NULL transmission mode value.
Only for serializer
| #define IS_ATTR_FLAG_DEPENDENT | ( | x | ) |
| #define IS_ATTR_FLAG_LSENCAP | ( | x | ) |
| #define IS_ATTR_FLAG_PARTIAL | ( | x | ) |
| #define IS_ATTR_FLAG_TRANSITIVE | ( | x | ) |
| #define IS_ATTR_FLAG_WELL_KNOWN | ( | x | ) |
Message UPDATE.
Unpadded list of attributes, dAttributes defined by RFCs are "Well-Known", and should have the WELL_KNOWN bit set.
attr_flag is a bitfield bit flag 0 Well-Known Flag 1 Transitive Flag 2 Dependent Flag 3 Partial Flag 4 Link-state Encapsulated Flag
| #define PROTO_TRY | ( | o, | |
| res, | |||
| a ) |
Try-Catch macro for serialization/deserialization functions.
| typedef itadpath_t attr_advertisementpath_t |
Attribute AdvertisementPath.
flags: well-known mandatory if ReachableRoutes or WithdrawnRoutes present list of ITAD path segments
| typedef void attr_atomicaggregate_t |
Attribute AtomicAggregate.
flags: well-known no value
| typedef community_t attr_communities_t[] |
Attribute Communities.
flags: well-known, transitive list of communities
| typedef void attr_convertedroute_t |
Attribute ConvertedRoute.
flags: well-known no value
| typedef uint32_t attr_itadtopology_t[] |
Attribute ITAD Topology.
flags: well-known, link-state encapsulated list of peer ITADs
| typedef uint32_t attr_multiexitdisc_t |
Attribute MultiExitDiscriminator.
flags: well-known
| typedef route_t attr_reachableroutes_t[] |
Attribute ReachableRoutes.
flags: well-known, [link-state encapsulation] list of unpadded routes (see above)
| typedef itadpath_t attr_routedpath_t |
Attribute RoutedPath.
flags: well-known mandatory if ReachableRoutes present syntax same as AdvertisementPath
| typedef route_t attr_withdrawnroutes_t[] |
Attribute WithdrawnRoutes.
flags: well-known, [link-state encapsulation] list of unpadded routes
| typedef void msg_keepalive_t |
Message KEEPALIVE.
no value
| enum app_proto |
| enum attr_type |
| enum runtime_errors_e |
Serialization/deserialization runtime errors.
| struct __attribute__ | ( | (packed) | ) |
Message header.
Message NOTIFICATION.
Community.
ITAD path.
Attribute NextHopServer.
Route.
UPDATE link-state encapsulated attribute.
UPDATE attribute.
Capability information supported route types.
Capability information option.
Message OPEN.
Message OPEN optional paramter.
flags: well-known server: host [":" port] host: hostname, IPv4 dotted format or IPv6 enclosed in "[" "]" port: decimal number 1-65535
< Number of ITADs in path seg
< ITAD numbers path

