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

Method handleUpdate

Server/src/bgp/parseBGP.cpp:87–114  ·  view source on GitHub ↗

* handle BGP update message and store in DB * * \details Parses the bgp update message and store it in the DB. * * \param [in] data Pointer to the raw BGP message header * \param [in] size length of the data buffer (used to prevent overrun) * * \returns True if error, false if no error. */

Source from the content-addressed store, hash-verified

85 * \returns True if error, false if no error.
86 */
87bool parseBGP::handleUpdate(u_char *data, size_t size) {
88 bgp_msg::UpdateMsg::parsed_update_data parsed_data;
89 int read_size = 0;
90
91 if (parseBgpHeader(data, size) == BGP_MSG_UPDATE) {
92 data += BGP_MSG_HDR_LEN;
93
94 /*
95 * Parse the update message - stored results will be in parsed_data
96 */
97 bgp_msg::UpdateMsg uMsg(logger, p_entry->peer_addr, router_addr, p_info, debug);
98
99 if ((read_size=uMsg.parseUpdateMsg(data, data_bytes_remaining, parsed_data)) != (size - BGP_MSG_HDR_LEN)) {
100 LOG_NOTICE("%s: rtr=%s: Failed to parse the update message, read %d expected %d", p_entry->peer_addr,
101 router_addr.c_str(), read_size, (size - read_size));
102 return true;
103 }
104
105 data_bytes_remaining -= read_size;
106
107 /*
108 * Update the DB with the update data
109 */
110 UpdateDB(parsed_data);
111 }
112
113 return false;
114}
115
116/**
117 * handle BGP notify event - updates the down event with parsed data

Callers 1

ReadIncomingMsgMethod · 0.80

Calls 1

parseUpdateMsgMethod · 0.80

Tested by

no test coverage detected