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

Method bufferBMPMessage

Server/src/bmp/parseBMP.cpp:561–581  ·  view source on GitHub ↗

* Buffer remaining BMP message * * \details This method will read the remaining amount of BMP data and store it in the instance variable bmp_data. * Normally this is used to store the BGP message so that it can be parsed. * * \param [in] sock Socket to read the message from * * \returns true if successfully parsed the bmp peer down header, false otherwise * * \throws Strin

Source from the content-addressed store, hash-verified

559 * \throws String error
560 */
561void parseBMP::bufferBMPMessage(int sock) {
562 if (bmp_len <= 0)
563 return;
564
565 if (bmp_len > sizeof(bmp_data)) {
566 LOG_WARN("sock=%d: BMP message is invalid, length of %d is larger than max buffer size of %d",
567 sock, bmp_len, sizeof(bmp_data));
568 throw "BMP message length is too large for buffer, invalid BMP sender";
569 }
570
571 SELF_DEBUG("sock=%d: Buffering %d from socket", sock, bmp_len);
572 if ((bmp_data_len=Recv(sock, bmp_data, bmp_len, MSG_WAITALL)) != bmp_len) {
573 LOG_ERR("sock=%d: Couldn't read all %d bytes into buffer",
574 sock, bmp_len);
575 throw "Error while reading BMP data into buffer";
576 }
577
578 // Indicate no more data is left to read
579 bmp_len = 0;
580
581}
582
583/**
584 * Parse the peer UP informational data

Callers 1

ReadIncomingMsgMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected