Skip to content
Snippets Groups Projects
Commit e23ae088 authored by Adam Knapp's avatar Adam Knapp
Browse files

Merge branch 'master' into 'master'

add Java implementation of HTTP test port with correct manifest

See merge request !2
parents 9a0dfdec 89267e15
No related branches found
No related tags found
1 merge request!2add Java implementation of HTTP test port with correct manifest
Showing with 1473 additions and 0 deletions
<?xml version="1.0" encoding="UTF-8"?><TITAN_Designer_Properties>
<ActiveConfiguration>Default</ActiveConfiguration>
<ProjectProperties>
<MakefileSettings>
<targetExecutable>java_bin\titan.JavaTestPorts.HTTPmsg.jar</targetExecutable>
</MakefileSettings>
<LocalBuildSettings>
<MakefileScript/>
<workingDirectory>java_src</workingDirectory>
</LocalBuildSettings>
</ProjectProperties>
</TITAN_Designer_Properties>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="java_src"/>
<classpathentry kind="src" path="user_provided"/>
<classpathentry kind="output" path="java_bin"/>
</classpath>
#Class files
/java_bin/
# Generated java files
/java_src/
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>titan.JavaTestPorts.HTTPmsg</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.titan.designer.core.TITANJavaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.titan.designer.core.TITANNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: titan.JavaTestPorts.HTTPmsg
Bundle-SymbolicName: titan.JavaTestPorts.HTTPmsg; singleton:=true
Bundle-Version: 1.0.0
Require-Bundle: org.eclipse.titan.runtime;bundle-version="1.0.0",
org.antlr.runtime;bundle-version="4.7.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.titan.titan_JavaTestPorts_HTTPmsg.generated,
org.eclipse.titan.titan_JavaTestPorts_HTTPmsg.user_provided
source.. = java_src/,\
user_provided/
output.. = java_bin/
bin.includes = META-INF/,\
.
package org.eclipse.titan.titan_JavaTestPorts_HTTPmsg.user_provided;
import org.eclipse.titan.runtime.core.TTCN_Buffer;
import org.eclipse.titan.runtime.core.TitanInteger;
import org.eclipse.titan.runtime.core.TitanOctetString;
import org.eclipse.titan.titan_JavaTestPorts_HTTPmsg.generated.HTTPmsg__Types;
public class HTTPmsg__MessageLen_externalfunctions {
public static TitanInteger f__HTTPMessage__len(final TitanOctetString stream) {
HTTPmsg__Types.HTTPMessage msg = new HTTPmsg__Types.HTTPMessage();
TTCN_Buffer buf_p = new TTCN_Buffer();
buf_p.put_os(stream);
int buf_len = buf_p.get_read_len();
if (buf_len > 0) {
if (HTTPmsg__PT.f_HTTP_decodeCommon(buf_p, msg, true, false, null, null)) {
buf_len -= buf_p.get_read_len();
} else {
buf_len = -1;
}
} else {
buf_len = -1;
}
buf_p = null;
return new TitanInteger(buf_len);
}
}
package org.eclipse.titan.titan_JavaTestPorts_HTTPmsg.user_provided;
import org.eclipse.titan.runtime.core.TTCN_Buffer;
import org.eclipse.titan.runtime.core.TTCN_Logger;
import org.eclipse.titan.runtime.core.TTCN_Logger.Severity;
import org.eclipse.titan.runtime.core.TitanBoolean;
import org.eclipse.titan.runtime.core.TitanInteger;
import org.eclipse.titan.runtime.core.TitanOctetString;
import org.eclipse.titan.titan_JavaTestPorts_HTTPmsg.generated.HTTPmsg__Types.HTTPMessage;
//=========================================================================
//==== Encoder-decoder Functions independent from sending and receiving:===
//=========================================================================
public class HTTPmsg__Types_externalfunctions {
/*********************************************************
* Function: enc__HTTPMessage
*
* Purpose:
* To encode msg type of HTTPMessage into OCTETSTRING separated from sending functionality
* It is for users using this test port as a protocol module
*
* References:
* RFC2616
*
* Precondition:
* msg is filled in properly
* Postcondition:
*
*
* Parameters:
* msg - the HTTP Message to be encoded
*
* Return Value:
* OCTETSTRING - the encoded message
* Detailed Comments:
* -
*
*********************************************************/
public static TitanOctetString enc__HTTPMessage(HTTPMessage msg) {
TTCN_Buffer buf = new TTCN_Buffer();
buf.clear();
HTTPmsg__PT.f_HTTP_encodeCommon(msg, buf);
return new TitanOctetString(buf.get_data());
}
/*********************************************************
* Function: dec__HTTPMessage
*
* Purpose:
* To decode msg type of OCTETSTRING into HTTPMessage separated from receiving functionality
* It is for users using this test port as a protocol module
*
* References:
* RFC2616
*
* Precondition:
* stream is filled in properly
* Postcondition:
* -
*
* Parameters:
* stream - the message to be decoded
* msg - reference to the record type of HTTPMessage which will contain the decoded value if the return value less than the length of the original stream
* Return Value:
* integer - the length of the remaining data which is not decoded yet.
* Detailed Comments:
* If the full stream is decoded, the return value is zero
* If nothing is decoded (decoding failed) the return value equals to the original length of the stream
*
*********************************************************/
public static TitanInteger dec__HTTPMessage(TitanOctetString stream, HTTPMessage msg, TitanBoolean socket_debugging) {
TTCN_Logger.log(Severity.DEBUG_TESTPORT, "starting HTTPmsg__Types.dec__HTTPMessage");
TTCN_Buffer buf_p = new TTCN_Buffer();
buf_p.put_os(stream);
int buf_len = buf_p.get_read_len();
if (buf_len > 0) {
if (HTTPmsg__PT.f_HTTP_decodeCommon(buf_p, msg, true, socket_debugging.get_value(), null, null)) {
HTTPmsg__PT.log_debug(socket_debugging.get_value(), "","","dec__HTTPMessage, after decoding:\nbuf_len: %d\nget_len: %d\nget_read_len:%d", buf_len, buf_p.get_len(), buf_p.get_read_len());;
buf_len = buf_p.get_read_len(); //remaining data length
} else {
buf_len = -1;
}
} else {
buf_len = -1;
}
buf_p = null;
return new TitanInteger(buf_len);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment