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

Function TSCacheKeyHostNameSet

src/api/InkAPI.cc:3040–3058  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3038}
3039
3040TSReturnCode
3041TSCacheKeyHostNameSet(TSCacheKey key, const char *hostname, int host_len)
3042{
3043 sdk_assert(sdk_sanity_check_cachekey(key) == TS_SUCCESS);
3044 sdk_assert(sdk_sanity_check_null_ptr((void *)hostname) == TS_SUCCESS);
3045 sdk_assert(host_len > 0);
3046
3047 if ((reinterpret_cast<CacheInfo *>(key))->magic != CACHE_INFO_MAGIC_ALIVE) {
3048 return TS_ERROR;
3049 }
3050
3051 CacheInfo *i = reinterpret_cast<CacheInfo *>(key);
3052 /* need to make a copy of the hostname. The caller
3053 might deallocate it anytime in the future */
3054 i->hostname = static_cast<char *>(ats_malloc(host_len));
3055 memcpy(i->hostname, hostname, host_len);
3056 i->len = host_len;
3057 return TS_SUCCESS;
3058}
3059
3060TSReturnCode
3061TSCacheKeyPinnedSet(TSCacheKey key, time_t pin_in_cache)

Callers

nothing calls this directly

Calls 4

ats_mallocFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected