MCPcopy Create free account
hub / github.com/Haivision/srt / SrtExtractHandshakeExtensions

Function SrtExtractHandshakeExtensions

srtcore/core.cpp:2057–2086  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2055}
2056
2057void SrtExtractHandshakeExtensions(const char* bufbegin, size_t buflength,
2058 vector<SrtHandshakeExtension>& w_output)
2059{
2060 const uint32_t *begin = reinterpret_cast<const uint32_t *>(bufbegin + CHandShake::m_iContentSize);
2061 size_t size = buflength - CHandShake::m_iContentSize; // Due to previous cond check we grant it's >0
2062 const uint32_t *next = 0;
2063 size_t length = size / sizeof(uint32_t);
2064 size_t blocklen = 0;
2065
2066 for (;;) // ONE SHOT, but continuable loop
2067 {
2068 const int cmd = FindExtensionBlock(begin, length, (blocklen), (next));
2069
2070 if (cmd == SRT_CMD_NONE)
2071 {
2072 // End of blocks
2073 break;
2074 }
2075
2076 w_output.push_back(SrtHandshakeExtension(cmd));
2077
2078 SrtHandshakeExtension& ext = w_output.back();
2079
2080 std::copy(begin+1, begin+blocklen+1, back_inserter(ext.contents));
2081
2082 // Any other kind of message extracted. Search on.
2083 if (!NextExtensionBlock((begin), next, (length)))
2084 break;
2085 }
2086}
2087
2088#if SRT_DEBUG_RTT
2089class RttTracer

Callers

nothing calls this directly

Calls 4

FindExtensionBlockFunction · 0.85
NextExtensionBlockFunction · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected