pespin submitted this change.

View Change

Approvals: osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified
HTTP_Adapter: Rename s/g_pars/g_http_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(-)

diff --git a/library/HTTP_Adapter.ttcn b/library/HTTP_Adapter.ttcn
index 97233e5..d970416 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_http_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_http_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_http_pars.http_host, g_http_pars.http_port, g_http_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_http_pars.http_host & ":" & int2str(g_http_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_http_pars.http_host & ":" & int2str(g_http_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_http_pars.http_host & ":" & int2str(g_http_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!");

To view, visit change 38018. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ia07cf8717593073a71632e247d7fe0775e66eb13
Gerrit-Change-Number: 38018
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann@sysmocom.de>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-CC: laforge <laforge@osmocom.org>