This func is called by us from mytest_handler to test TSHttpTxnClientIPGet
| 3070 | |
| 3071 | // This func is called by us from mytest_handler to test TSHttpTxnClientIPGet |
| 3072 | static int |
| 3073 | checkHttpTxnClientIPGet(SocketTest *test, void *data) |
| 3074 | { |
| 3075 | sockaddr const *ptr; |
| 3076 | in_addr_t ip; |
| 3077 | TSHttpTxn txnp = static_cast<TSHttpTxn>(data); |
| 3078 | in_addr_t actual_ip = htonl(INADDR_LOOPBACK); /* 127.0.0.1 is expected because the client is on the same machine */ |
| 3079 | |
| 3080 | ptr = TSHttpTxnClientAddrGet(txnp); |
| 3081 | if (ptr == nullptr || INADDR_ANY == (ip = ats_ip4_addr_cast(ptr))) { |
| 3082 | test->test_client_ip_get = false; |
| 3083 | SDK_RPRINT(test->regtest, "TSHttpTxnClientIPGet", "TestCase1", TC_FAIL, "TSHttpTxnClientIPGet returns 0 %s", |
| 3084 | ptr ? "address" : "pointer"); |
| 3085 | return TS_EVENT_CONTINUE; |
| 3086 | } |
| 3087 | |
| 3088 | if (ip == actual_ip) { |
| 3089 | test->test_client_ip_get = true; |
| 3090 | SDK_RPRINT(test->regtest, "TSHttpTxnClientIPGet", "TestCase1", TC_PASS, "ok [%0.8x]", ip); |
| 3091 | } else { |
| 3092 | test->test_client_ip_get = false; |
| 3093 | SDK_RPRINT(test->regtest, "TSHttpTxnClientIPGet", "TestCase1", TC_FAIL, "Value's Mismatch [expected %.8x got %.8x]", actual_ip, |
| 3094 | ip); |
| 3095 | } |
| 3096 | return TS_EVENT_CONTINUE; |
| 3097 | } |
| 3098 | |
| 3099 | // This func is called by us from mytest_handler to check for TSHttpTxnClientProtocolStackGet |
| 3100 | static int |
no test coverage detected