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

Function transform_connect

plugins/experimental/icap/icap_plugin.cc:443–465  ·  view source on GitHub ↗

* transform_connect * Description: Issue a socket connection to icap server. */

Source from the content-addressed store, hash-verified

441 * Description: Issue a socket connection to icap server.
442 */
443static int
444transform_connect(TSCont contp, TransformData *data)
445{
446 TSAction action;
447 struct sockaddr_in ip_addr;
448 data->state = State::CONNECT;
449
450 /* Only support IPv4 at this point */
451 memset(&ip_addr, 0, sizeof(ip_addr));
452 ip_addr.sin_family = AF_INET;
453 ip_addr.sin_port = htons(server_port);
454 if (inet_pton(AF_INET, server_ip.c_str(), &ip_addr.sin_addr) <= 0) {
455 TSError("[%s] Invalid address: %s", PLUGIN_NAME, server_ip.c_str());
456 return 0;
457 }
458 action = TSNetConnect(contp, reinterpret_cast<struct sockaddr const *>(&ip_addr));
459
460 if (!TSActionDone(action)) {
461 data->pending_action = action;
462 }
463
464 return 0;
465}
466
467static int
468transform_write_body(TransformData *data)

Callers 1

transform_handlerFunction · 0.70

Calls 5

memsetFunction · 0.85
TSNetConnectFunction · 0.85
TSActionDoneFunction · 0.85
TSErrorFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected