| 6146 | }; |
| 6147 | |
| 6148 | TSAction |
| 6149 | TSHostLookup(TSCont contp, const char *hostname, size_t namelen) |
| 6150 | { |
| 6151 | sdk_assert(sdk_sanity_check_continuation(contp) == TS_SUCCESS); |
| 6152 | sdk_assert(sdk_sanity_check_null_ptr((void *)hostname) == TS_SUCCESS); |
| 6153 | sdk_assert(namelen > 0); |
| 6154 | |
| 6155 | FORCE_PLUGIN_SCOPED_MUTEX(contp); |
| 6156 | |
| 6157 | // There is no place to store the actual sockaddr to which a pointer should be returned. |
| 6158 | // therefore an intermediate continuation is created to intercept the reply from HostDB. |
| 6159 | // Its handler can create the required sockaddr context on the stack and then forward |
| 6160 | // the event to the plugin continuation. The sockaddr cannot be placed in the HostDB |
| 6161 | // record because that is a shared object. |
| 6162 | auto bouncer = INKContAllocator.alloc(); |
| 6163 | bouncer->init(&TSHostLookupTrampoline, reinterpret_cast<TSMutex>(reinterpret_cast<INKContInternal *>(contp)->mutex.get())); |
| 6164 | bouncer->mdata = contp; |
| 6165 | return reinterpret_cast<TSAction>(hostDBProcessor.getbyname_re(bouncer, hostname, namelen)); |
| 6166 | } |
| 6167 | |
| 6168 | sockaddr const * |
| 6169 | TSHostLookupResultAddrGet(TSHostLookupResult lookup_result) |
no test coverage detected