* handle BGP notify event - updates the down event with parsed data * * \details * The notify message does not directly add to Db, so the calling * method/function must handle that. * * \param [in] data Pointer to the raw BGP message header * \param [in] size length of the data buffer (used to prevent overrun) * \param [out] down_event Reference t
| 127 | * \returns True if error, false if no error. |
| 128 | */ |
| 129 | bool parseBGP::handleDownEvent(u_char *data, size_t size, MsgBusInterface::obj_peer_down_event &down_event) { |
| 130 | bool rval; |
| 131 | |
| 132 | // Process the BGP message normally |
| 133 | if (parseBgpHeader(data, size) == BGP_MSG_NOTIFICATION) { |
| 134 | data += BGP_MSG_HDR_LEN; |
| 135 | |
| 136 | bgp_msg::parsed_notify_msg parsed_msg; |
| 137 | bgp_msg::NotificationMsg nMsg(logger, debug); |
| 138 | if ( (rval=nMsg.parseNotify(data, data_bytes_remaining, parsed_msg))) |
| 139 | LOG_ERR("%s: rtr=%s: Failed to parse the BGP notification message", p_entry->peer_addr, router_addr.c_str()); |
| 140 | |
| 141 | else { |
| 142 | data += 2; // Move pointer past notification message |
| 143 | data_bytes_remaining -= 2; |
| 144 | |
| 145 | down_event.bgp_err_code = parsed_msg.error_code; |
| 146 | down_event.bgp_err_subcode = parsed_msg.error_subcode; |
| 147 | strncpy(down_event.error_text, parsed_msg.error_text, sizeof(down_event.error_text)); |
| 148 | } |
| 149 | } |
| 150 | else { |
| 151 | LOG_ERR("%s: rtr=%s: BGP message type is not a BGP notification, cannot parse the notification", |
| 152 | p_entry->peer_addr, router_addr.c_str()); |
| 153 | throw "ERROR: Invalid BGP MSG for BMP down event, expected NOTIFICATION message."; |
| 154 | } |
| 155 | |
| 156 | return rval; |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Handles the up event by parsing the BGP open messages - Up event will be updated |
no test coverage detected