| 48 | } |
| 49 | |
| 50 | bool |
| 51 | SSLNextProtocolSet::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 | |
| 81 | fail: |
| 82 | ats_free(*npn); |
| 83 | *npn = nullptr; |
| 84 | *len = 0; |
| 85 | return false; |
| 86 | } |
| 87 | |
| 88 | bool |
| 89 | SSLNextProtocolSet::registerEndpoint(const char *proto, Continuation *ep) |
no test coverage detected