| 839 | } |
| 840 | |
| 841 | int |
| 842 | SessionProtocolNameRegistry::toIndex(swoc::TextView name) |
| 843 | { |
| 844 | int zret = this->indexFor(name); |
| 845 | if (INVALID == zret) { |
| 846 | if (m_n < MAX) { |
| 847 | // Localize the name by copying it in to the arena. |
| 848 | auto text = m_arena.alloc(name.size() + 1).rebind<char>(); |
| 849 | memcpy(text, name); |
| 850 | text.end()[-1] = '\0'; |
| 851 | m_names[m_n].assign(text.data(), name.size()); |
| 852 | zret = m_n++; |
| 853 | } else { |
| 854 | ink_release_assert(!"Session protocol name registry overflow"); |
| 855 | } |
| 856 | } |
| 857 | return zret; |
| 858 | } |
| 859 | |
| 860 | int |
| 861 | SessionProtocolNameRegistry::toIndexConst(TextView name) |