MCPcopy Create free account
hub / github.com/apache/trafficserver / create_npn_advertisement

Method create_npn_advertisement

src/iocore/net/SSLNextProtocolSet.cc:50–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50bool
51SSLNextProtocolSet::create_npn_advertisement(const SessionProtocolSet &enabled, unsigned char **npn, size_t *len) const
52{
53 const SSLNextProtocolSet::NextProtocolEndpoint *ep;
54 unsigned char *advertised;
55
56 ats_free(*npn);
57 *npn = nullptr;
58 *len = 0;
59
60 for (ep = endpoints.head; ep != nullptr; ep = endpoints.next(ep)) {
61 if (enabled.contains(globalSessionProtocolNameRegistry.toIndex(swoc::TextView{ep->protocol, strlen(ep->protocol)}))) {
62 ink_release_assert((strlen(ep->protocol) > 0));
63 *len += (strlen(ep->protocol) + 1);
64 }
65 }
66
67 *npn = advertised = static_cast<unsigned char *>(ats_malloc(*len));
68 if (!(*npn)) {
69 goto fail;
70 }
71
72 for (ep = endpoints.head; ep != nullptr; ep = endpoints.next(ep)) {
73 if (enabled.contains(globalSessionProtocolNameRegistry.toIndex(swoc::TextView{ep->protocol, strlen(ep->protocol)}))) {
74 Dbg(dbg_ctl_ssl, "advertising protocol %s, %p", ep->protocol, ep->endpoint);
75 advertised = append_protocol(ep->protocol, advertised);
76 }
77 }
78
79 return true;
80
81fail:
82 ats_free(*npn);
83 *npn = nullptr;
84 *len = 0;
85 return false;
86}
87
88bool
89SSLNextProtocolSet::registerEndpoint(const char *proto, Continuation *ep)

Callers 3

disableProtocolMethod · 0.80
enableProtocolMethod · 0.80

Calls 6

ats_freeFunction · 0.85
ats_mallocFunction · 0.85
append_protocolFunction · 0.85
toIndexMethod · 0.80
nextMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected