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

Function checkHttpTxnServerIPGet

src/api/InkAPITest.cc:3243–3268  ·  view source on GitHub ↗

This func is called by us from mytest_handler to test TSHttpTxnServerIPGet

Source from the content-addressed store, hash-verified

3241
3242// This func is called by us from mytest_handler to test TSHttpTxnServerIPGet
3243static int
3244checkHttpTxnServerIPGet(SocketTest *test, void *data)
3245{
3246 sockaddr const *ptr;
3247 in_addr_t ip;
3248 TSHttpTxn txnp = static_cast<TSHttpTxn>(data);
3249 in_addr_t actual_ip = htonl(INADDR_LOOPBACK); /* 127.0.0.1 is expected because the client is on the same machine */
3250
3251 ptr = TSHttpTxnServerAddrGet(txnp);
3252 if (nullptr == ptr || 0 == (ip = ats_ip4_addr_cast(ptr))) {
3253 test->test_server_ip_get = false;
3254 SDK_RPRINT(test->regtest, "TSHttpTxnServerIPGet", "TestCase1", TC_FAIL, "TSHttpTxnServerIPGet returns 0 %s",
3255 ptr ? "address" : "pointer");
3256 return TS_EVENT_CONTINUE;
3257 }
3258
3259 if (ip == actual_ip) {
3260 test->test_server_ip_get = true;
3261 SDK_RPRINT(test->regtest, "TSHttpTxnServerIPGet", "TestCase1", TC_PASS, "ok");
3262 } else {
3263 test->test_server_ip_get = false;
3264 SDK_RPRINT(test->regtest, "TSHttpTxnServerIPGet", "TestCase1", TC_FAIL, "Value's Mismatch");
3265 }
3266
3267 return TS_EVENT_CONTINUE;
3268}
3269
3270// This func is called by us from mytest_handler to test TSHttpTxnIncomingAddrGet
3271static int

Callers 1

mytest_handlerFunction · 0.85

Calls 2

TSHttpTxnServerAddrGetFunction · 0.85
SDK_RPRINTFunction · 0.85

Tested by

no test coverage detected