Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TTCN-3 Libraries
LibIts
Commits
a176b865
Commit
a176b865
authored
May 30, 2018
by
garciay
Browse files
Update HTTP Ng112 to ITS
parent
d2486f17
Changes
9
Hide whitespace changes
Inline
Side-by-side
ttcn/Http/LibItsHttp_EncdecDeclarations.ttcn
0 → 100644
View file @
a176b865
module
LibItsHttp_EncdecDeclarations
{
// LibHttp
import
from
LibItsHttp_TypesAndValues
all
;
external
function
fx_enc_http_message
(
HttpMessage
p
)
return
bitstring
with
{
extension
"prototype(convert) encode(HttpCodec)"
}
external
function
fx_dec_http_message
(
inout
bitstring
b
,
out
HttpMessage
p
)
return
integer
with
{
extension
"prototype(sliding) decode(HttpCodec)"
}
}
// End of module LibItsHttp_EncdecDeclarations
ttcn/Http/LibItsHttp_Functions.ttcn
0 → 100644
View file @
a176b865
module
LibItsHttp_Functions
{
// LibHttp
import
from
LibItsHttp_TypesAndValues
all
;
import
from
LibItsHttp_Pics
all
;
function
f_init_default_headers_list
(
out
HeaderLines
p_headers
)
{
p_headers
[
0
]
:=
{
c_header_host
,
{
PICS_HEADER_HOST
}
};
p_headers
[
1
]
:=
{
c_header_content_type
,
{
PICS_HEADER_CONTENT_TYPE
}
};
p_headers
[
2
]
:=
{
c_header_connection
,
{
"keep-alive"
}
};
p_headers
[
3
]
:=
{
c_header_pragma
,
{
"no-cache"
}
};
p_headers
[
4
]
:=
{
c_header_cache_control
,
{
"no-cache"
}
};
}
// End of function f_init_default_headers_list
function
f_remove_headears_list
(
in
charstring_list
p_headers_to_remove
,
inout
HeaderLines
p_headers
)
{
// Sanity checks
if
(
lengthof
(
p_headers_to_remove
)
==
0
)
{
return
;
}
else
if
(
lengthof
(
p_headers
)
==
0
)
{
return
;
}
for
(
var
integer
v_idx
:=
0
;
v_idx
<
lengthof
(
p_headers_to_remove
);
v_idx
:=
v_idx
+
1
)
{
for
(
var
integer
v_jdx
:=
0
;
v_jdx
<
lengthof
(
p_headers
);
v_jdx
:=
v_jdx
+
1
)
{
if
(
p_headers
[
v_jdx
].
header_name
==
p_headers_to_remove
[
v_idx
])
{
p_headers
[
v_jdx
].
header_value
:=
omit
;
// NOTE Codec won't encode it
}
}
// End of 'for' statement
}
// End of 'for' statement
}
// End of function f_init_default_headers_list
}
// End of module LibItsHttp_Functions
ttcn/Http/LibItsHttp_MessageBodyTypes.ttcn
0 → 100644
View file @
a176b865
module
LibItsHttp_MessageBodyTypes
{
// LibHttp
import
from
LibItsHttp_XmlMessageBodyTypes
all
;
type
octetstring
MsdBody
;
type
union
HttpMessageBody
{
MsdBody
ms_body
,
XmlBody
xml_body
}
// End of type HttpMessageBody
}
// End of module LibItsHttp_MessageBodyTypes
ttcn/Http/LibItsHttp_Pics.ttcn
0 → 100644
View file @
a176b865
module
LibItsHttp_Pics
{
/**
* @desc
*/
modulepar
charstring
PICS_HEADER_HOST
:=
"http://www.lisp.com"
;
/**
* @desc
*/
modulepar
charstring
PICS_HEADER_CONTENT_TYPE
:=
"application/held+xml;charset=utf-8"
;
}
// End of module LibItsHttp_Pics
ttcn/Http/LibItsHttp_Templates.ttcn
View file @
a176b865
...
...
@@ -13,50 +13,92 @@ module LibItsHttp_Templates {
// LibHttp
import
from
LibItsHttp_TypesAndValues
all
;
import
from
LibItsHttp_MessageBodyTypes
all
;
import
from
LibItsHttp_XmlMessageBodyTypes
all
;
template
(
value
)
HeaderLine
m_header_line
(
in
template
(
value
)
charstring
p_header_name
,
in
template
(
value
)
charstring_list
p_header_value
)
:=
{
header_name
:=
p_header_name
,
header_value
:=
p_header_value
}
// End of template m_header_line
group
http_messages
{
template
(
value
)
HttpMessage
m_http_request
(
in
template
(
value
)
Request
p_request
)
:=
{
request
:=
p_request
}
// End of template m_http_request
template
(
present
)
HttpMessage
mw_http_request
(
template
(
present
)
Request
p_request
:=
?
)
:=
{
request
:=
p_request
}
// End of template mw_http_request
template
(
value
)
HttpMessage
m_http_response
(
in
template
(
value
)
Response
p_response
)
:=
{
response
:=
p_response
}
// End of template m_http_response
template
(
present
)
HttpMessage
mw_http_response
(
template
(
present
)
Response
p_response
:=
?
)
:=
{
response
:=
p_response
}
// End of template mw_http_response
}
// End of group http_messages
template
(
value
)
HttpMessage
m_http_request
(
in
template
(
value
)
Request
p_request
)
:=
{
request
:=
p_request
}
// End of template m_http_request
group
http_headers
{
template
(
value
)
HeaderLine
m_header_line
(
in
template
(
value
)
charstring
p_header_name
,
in
template
(
value
)
charstring_list
p_header_value
)
:=
{
header_name
:=
p_header_name
,
header_value
:=
p_header_value
}
// End of template m_header_line
template
(
present
)
HttpMessage
mw_http_request
(
template
(
present
)
Request
p_request
:=
?
)
:=
{
request
:=
p_request
}
// End of template mw_http_request
}
// End of group http_headers
template
(
value
)
HttpMessage
m_http_response
(
in
template
(
value
)
Response
p_response
)
:=
{
response
:=
p_response
}
// End of template m_http_response
group
http_requests
{
template
(
omit
)
Request
m_http_request_get
(
in
charstring
p_uri
,
in
template
(
value
)
HeaderLines
p_headers
,
in
template
(
omit
)
HttpMessageBody
p_body
:=
omit
)
:=
{
method
:=
"GET"
,
uri
:=
p_uri
,
version_major
:=
c_http_version_major
,
version_minor
:=
c_http_version_minor
,
header
:=
p_headers
,
body
:=
p_body
}
// End of template m_http_request_get
}
// End of group http_requests
group
http_responses
{
template
(
present
)
Response
mw_http_response_ok
(
template
(
present
)
HttpMessageBody
p_body
:=
?
,
template
(
present
)
HeaderLines
p_header
:=
?
)
:=
{
version_major
:=
1
,
version_minor
:=
1
,
statuscode
:=
200
,
statustext
:=
"OK"
,
header
:=
p_header
,
body
:=
p_body
}
// End of template mw_http_response_ok
}
// End of group http_responses
template
(
present
)
HttpMessage
m
w
_http_
r
es
ponse
(
template
(
present
)
Response
p_response
:=
?
template
(
value
)
HttpMessage
Body
m_http_
m
es
sage_body_xml
(
in
template
(
value
)
XmlBody
p_xml_body
)
:=
{
response
:=
p_response
}
// End of template m
w
_http_
r
es
ponse
xml_body
:=
p_xml_body
}
// End of template m_http_
m
es
sage_body_xml
template
(
omit
)
Request
m_http_request_get
(
in
charstring
p_uri
,
in
template
(
value
)
HeaderLines
p_headers
,
in
template
(
omit
)
charstring
p_body
:=
omit
template
(
present
)
HttpMessageBody
mw_http_message_body_xml
(
template
(
present
)
XmlBody
p_xml_body
:=
?
)
:=
{
method
:=
"GET"
,
uri
:=
p_uri
,
version_major
:=
c_http_version_major
,
version_minor
:=
c_http_version_minor
,
header
:=
p_headers
,
body
:=
p_body
}
// End of template m_http_request_get
xml_body
:=
p_xml_body
}
// End of template mw_http_message_body_xml
}
// End of module LibItsHttp_Templates
ttcn/Http/LibItsHttp_TestSystem.ttcn
0 → 100644
View file @
a176b865
/**
* @author ETSI / STF545
* @version $URL$
* $ID:$
* @desc This module provides the test system used by ITS HTTP based protocols.
* @copyright ETSI Copyright Notification
* No part may be reproduced except as authorized by written permission.
* The copyright and the foregoing restriction extend to reproduction in all media.
* All rights reserved.
* @see ETSI TS 103 478
*/
module
LibItsHttp_TestSystem
{
// LibCommon
import
from
LibCommon_Sync
all
;
import
from
LibCommon_Time
all
;
// LibItsHttp
import
from
LibItsHttp_TypesAndValues
all
;
type
port
HttpPort
message
{
inout
HttpMessage
;
}
type
component
HttpComponent
extends
SelfSyncComp
{
port
HttpPort
httpPort
;
timer
tc_ac
:=
PX_TAC
;
}
// End of component HttpComponent
}
// End of module LibItsHttp_TestSystem
ttcn/Http/LibItsHttp_TypesAndValues.ttcn
View file @
a176b865
...
...
@@ -11,13 +11,24 @@
*/
module
LibItsHttp_TypesAndValues
{
// LibHttp
import
from
LibItsHttp_MessageBodyTypes
all
;
import
from
LibItsHttp_XmlMessageBodyTypes
all
;
const
charstring
c_header_host
:=
"Host"
;
const
charstring
c_header_content_type
:=
"Content-type"
;
const
charstring
c_header_accept
:=
"Accept"
;
const
charstring
c_header_connection
:=
"Connection"
;
const
charstring
c_header_pragma
:=
"Pragma"
;
const
charstring
c_header_cache_control
:=
"Cache-Control"
;
const
integer
c_http_version_major
:=
1
;
const
integer
c_http_version_minor
:=
1
;
type
record
of
charstring
charstring_list
;
type
record
HeaderLine
{
charstring
header_name
,
charstring_list
header_value
charstring_list
header_value
optional
}
with
{
variant
"FIELDORDER(msb)"
}
...
...
@@ -30,7 +41,7 @@ module LibItsHttp_TypesAndValues {
integer
version_major
,
integer
version_minor
,
HeaderLines
header
,
charstring
body
optional
HttpMessageBody
body
optional
}
with
{
variant
"FIELDORDER(msb)"
}
...
...
@@ -41,7 +52,7 @@ module LibItsHttp_TypesAndValues {
integer
statuscode
,
charstring
statustext
,
HeaderLines
header
,
charstring
body
optional
HttpMessageBody
body
optional
}
with
{
variant
"FIELDORDER(msb)"
}
...
...
@@ -50,10 +61,10 @@ module LibItsHttp_TypesAndValues {
Response
response
,
Request
request
}
with
{
variant
"
FIELDORDER(msb)
"
variant
""
}
}
with
{
variant
""
encode
"Htt
c
pCodec"
encode
"HttpCodec"
}
// End of module LibItsHttp_TypesAndValues
ttcn/Http/LibItsHttp_XMLTypes.ttcn
0 → 100644
View file @
a176b865
module
LibItsHttp_XMLTypes
{
// FIXME To be removed
/**
* This file is volontary empry. You have to declare all XSD files required by your project
* In addition, the TTCN-3 module LibItsHttp_XmlMessageBodyTypes have to be updated too.
*/
// RFC5985 Held
import
from
XSD
all
;
import
from
urn_ietf_params_xml_ns_geopriv_held
language
"XSD"
all
;
}
// End of module LibItsHttp_XMLTypes
ttcn/Http/LibItsHttp_XmlMessageBodyTypes.ttcn
0 → 100644
View file @
a176b865
module
LibItsHttp_XmlMessageBodyTypes
{
// LibItsHttp
import
from
LibItsHttp_XMLTypes
all
;
// RFC5985 Held
import
from
XSD
all
;
import
from
urn_ietf_params_xml_ns_geopriv_held
language
"XSD"
all
;
/**
* This file volontary contains a trivial declaration of the type XmlBodu.
* In accordance with your TTCN-3 module LibItsHttp_XMLTypes, you have to change the XmlBody typing.
*/
type
union
XmlBody
{
LocationRequest
locationRequest
,
LocationResponse
locationResponse
,
charstring
raw
};
}
// End of LibItsHttp_XmlMessageBodyTypes
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment