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

Function CB_cert_update

example/plugins/c-api/cert_update/cert_update.cc:40–75  ·  view source on GitHub ↗

Plugin Message Continuation

Source from the content-addressed store, hash-verified

38
39// Plugin Message Continuation
40int
41CB_cert_update(TSCont, TSEvent, void *edata)
42{
43 TSPluginMsg *msg = static_cast<TSPluginMsg *>(edata);
44 static constexpr std::string_view PLUGIN_PREFIX("cert_update.");
45
46 std::string_view tag(msg->tag, strlen(msg->tag));
47 const char *server_cert_path = nullptr;
48 const char *client_cert_path = nullptr;
49 if (tag.substr(0, PLUGIN_PREFIX.size()) == PLUGIN_PREFIX) {
50 tag.remove_prefix(PLUGIN_PREFIX.size());
51 if (tag == "server") {
52 server_cert_path = static_cast<const char *>(msg->data);
53 Dbg(dbg_ctl, "Received Msg to update server cert with %s", server_cert_path);
54 } else if (tag == "client") {
55 client_cert_path = static_cast<const char *>(msg->data);
56 Dbg(dbg_ctl, "Received Msg to update client cert with %s", client_cert_path);
57 }
58 }
59
60 if (server_cert_path) {
61 if (TS_SUCCESS == TSSslServerCertUpdate(server_cert_path, nullptr)) {
62 Dbg(dbg_ctl, "Successfully updated server cert with %s", server_cert_path);
63 } else {
64 Dbg(dbg_ctl, "Failed to update server cert with %s", server_cert_path);
65 }
66 }
67 if (client_cert_path) {
68 if (TS_SUCCESS == TSSslClientCertUpdate(client_cert_path, nullptr)) {
69 Dbg(dbg_ctl, "Successfully updated client cert with %s", client_cert_path);
70 } else {
71 Dbg(dbg_ctl, "Failed to update client cert with %s", client_cert_path);
72 }
73 }
74 return TS_SUCCESS;
75}
76
77void
78TSPluginInit(int /* argc ATS_UNUSED */, const char ** /* argv ATS_UNUSED */)

Callers

nothing calls this directly

Calls 5

TSSslServerCertUpdateFunction · 0.85
TSSslClientCertUpdateFunction · 0.85
substrMethod · 0.45
sizeMethod · 0.45
remove_prefixMethod · 0.45

Tested by

no test coverage detected