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

Function TSHostLookup

src/api/InkAPI.cc:6148–6166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6146};
6147
6148TSAction
6149TSHostLookup(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
6168sockaddr const *
6169TSHostLookupResultAddrGet(TSHostLookupResult lookup_result)

Callers 2

ts_lua_host_lookupFunction · 0.85

Calls 6

getbyname_reMethod · 0.80
allocMethod · 0.45
initMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected