pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38018?usp=email )
Change subject: HTTP_Adapter: Rename s/g_pars/g__pars ......................................................................
HTTP_Adapter: Rename s/g_pars/g__pars
The HTTP_Adapter component is a probable candidate to end up as part of another component extending it, like the Prometheus_Checker coming up soon. Since the fields in HTTP_Adapter are available to subclass components, that means they cannot use the usual "g_pars". Rename the self-enclosed "g_pars" in HTTP_Adapter to let subclasses use it.
Change-Id: Ia07cf8717593073a71632e247d7fe0775e66eb13 --- M library/HTTP_Adapter.ttcn 1 file changed, 7 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/18/38018/1
diff --git a/library/HTTP_Adapter.ttcn b/library/HTTP_Adapter.ttcn index 97233e5..bba0216 100644 --- a/library/HTTP_Adapter.ttcn +++ b/library/HTTP_Adapter.ttcn @@ -19,7 +19,8 @@
type component http_CT { port HTTPmsg_PT HTTP; - var HTTP_Adapter_Params g_pars; + /* double underscore to have "g_pars" available on components extending this one: */ + var HTTP_Adapter_Params g__pars; };
type record HTTP_Adapter_Params { @@ -30,7 +31,7 @@
function f_http_init(HTTP_Adapter_Params pars) runs on http_CT { map(self:HTTP, system:HTTP); - g_pars := pars; + g__pars := pars; }
template (value) Connect ts_HTTP_Connect(template (value) charstring hostname, @@ -187,7 +188,7 @@
/* In case the caller didn't specify a client_id, we will create a new connection. */ if (istemplatekind(client_id, "omit")) { - HTTP.send(ts_HTTP_Connect(g_pars.http_host, g_pars.http_port, g_pars.use_ssl)); + HTTP.send(ts_HTTP_Connect(g__pars.http_host, g__pars.http_port, g__pars.use_ssl)); T.start; alt { [] HTTP.receive(Connect_result:?) -> value rc; @@ -207,16 +208,16 @@
if (not istemplatekind(body, "omit") and istemplatekind(binary_body, "omit")) { /* HTTP message with ASCII content */ - HTTP.send(ts_HTTP_Req(url, method, body, host := g_pars.http_host & ":" & int2str(g_pars.http_port), + HTTP.send(ts_HTTP_Req(url, method, body, host := g__pars.http_host & ":" & int2str(g__pars.http_port), custom_hdr := custom_hdr, client_id := use_client_id)); } else if (not istemplatekind(binary_body, "omit") and istemplatekind(body, "omit")) { /* HTTP message with binary content */ HTTP.send(ts_HTTP_Req_Bin(url, method, binary_body, - host := g_pars.http_host & ":" & int2str(g_pars.http_port), + host := g__pars.http_host & ":" & int2str(g__pars.http_port), custom_hdr := custom_hdr, client_id := use_client_id)); } else if (istemplatekind(binary_body, "omit") and istemplatekind(body, "omit")) { /* HTTP message without content (e.g. a GET request) */ - HTTP.send(ts_HTTP_Req(url, method, host := g_pars.http_host & ":" & int2str(g_pars.http_port), + HTTP.send(ts_HTTP_Req(url, method, host := g__pars.http_host & ":" & int2str(g__pars.http_port), custom_hdr := custom_hdr, client_id := use_client_id)); } else { setverdict(fail, "either binary_body or body must be used (a request can contain either ASCII data or binary data, not both!");