MCPcopy Create free account
hub / github.com/SNAS/openbmp / parsePeerFlags

Method parsePeerFlags

Server/src/bmp/parseBMP.cpp:355–407  ·  view source on GitHub ↗

* Parse BMP peer header flags by peer type * * This method will update the instance variable "p_entry" * * \param [in] peer_type peer type from peer header * \param [in] peer_flags flags from peer header * */

Source from the content-addressed store, hash-verified

353 *
354 */
355void parseBMP::parsePeerFlags(u_char peer_type, u_char peer_flags) {
356
357 switch (peer_type) {
358 case 3: // Local RIB (draft-ietf-grow-bmp-local-rib)
359 p_entry->isLocRib = true;
360
361 if (peer_flags & 0x80) { // Indicates if the local-rib is filtered
362 p_entry->isLocRibFiltered = true;
363 }
364
365 break;
366
367 default:
368 p_entry->isLocRib = false;
369
370 if (peer_flags & 0x80) { // V flag of 1 means this is IPv6
371 p_entry->isIPv4 = false;
372
373 } else {
374 p_entry->isIPv4 = true;
375 }
376
377 if (peer_flags & 0x10) { // O flag of 1 means this is Adj-Rib-Out
378 SELF_DEBUG("Msg is for Adj-RIB-Out");
379 p_entry->isAdjIn = false;
380 }
381
382 if (peer_flags & 0x20) { // A flag of 1 means 2-octet encoding
383 SELF_DEBUG("Msg is 2-octet encoded");
384 p_entry->isTwoOctet = true;
385 }
386
387 if (peer_flags & 0x40) { // L flag of 1 means this is post-policy of Adj-RIB-In
388 SELF_DEBUG("Msg is for POST-POLICY Adj-RIB-In");
389 p_entry->isPrePolicy = false;
390 } else {
391 SELF_DEBUG("Msg is for PRE-POLICY Adj-RIB-In");
392 p_entry->isPrePolicy = true;
393 p_entry->isAdjIn = true;
394 }
395
396 // Is peer type L3VPN peer or global instance
397 if (peer_type == 1) // L3VPN
398 p_entry->isL3VPN = 1;
399
400 else
401 // Global Instance
402 p_entry->isL3VPN = 0;
403
404 break;
405 }
406
407}
408
409/**
410 * Parse the v3 peer header

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected