Please check our Instructions to Authors and send your manuscripts to nifs.journal@gmail.com. Next issue: September/October 2024.
Deadline for submissions: 16 November 2024.
GNTicker Trace Protocol: Difference between revisions
Line 78: | Line 78: | ||
== Methods == | == Methods == | ||
=== INIT === | === INIT === | ||
; Syntax | |||
: <source lang="xml">INIT</source> | |||
; Description | |||
: The INIT method should be the first method, which a client should use. A client should use the INIT method to send a GN definition to the server. Only one INIT method should be sent to the server by the client. Each new GN execution requires a new connection to the server. The message body is an XML definition of a generalized net starting with a <code><gn></code> element and conforming to GNschema.xsd. | |||
; Example | |||
<source lang="xml"> | |||
GNTP/0.1 | |||
INIT | |||
Content-Length: 492 | |||
<?xml version = "1.0"?> | |||
<gn xmlns = "http://www.clbme.bas.bg/GN" name = "MinimalGN"> | |||
<transitions> | |||
<transition id = "Z1"> | |||
<inputs> | |||
<input ref = "L1"/> | |||
</inputs> | |||
<outputs> | |||
<output ref = "L2"/> | |||
</outputs> | |||
<predicates/> | |||
</transition> | |||
</transitions> | |||
<places> | |||
<place id = "L1" priority = "1"/> | |||
<place id = "L2" priority = "1"/> | |||
</places> | |||
<tokens/> | |||
<functions/> | |||
</gn> | |||
</source> | |||
; Comment | |||
: A minimal GN is loaded in the server. | |||
=== HALT === | === HALT === | ||
; Syntax | |||
: <source lang="xml">HALT</source> | |||
; Description | |||
: Clients should use the HALT method to initiate halt of the GN execution. The client has to wait for the server to respond and close the connection. The HALT method should be used only after an INIT method. The HALT method does not require a message body. | |||
; Example | |||
<source lang="xml"> | |||
GNTP/0.1 | |||
HALT | |||
</source> | |||
; Comment | |||
: The current GN execution is halted and the memory for the GN is freed. | |||
=== STEP === | === STEP === | ||
=== STEPUNTIL === | === STEPUNTIL === | ||
Line 84: | Line 137: | ||
=== INPUT === | === INPUT === | ||
=== SAVE === | === SAVE === | ||
== Response codes == | == Response codes == |
Revision as of 19:58, 26 April 2009
GNTicker Trace Protocol (GNTP) is designed to allow two-way communication between the GNTicker server (TS) and its clients. The main tasks which can be accomplished using GNTP are:
- Sending a generalized net definition to the TS
- Receiving events for token movement, entrance, leaving or merging from the TS
- Performing a number of steps of the GN execution
- Executing the GN until a specific event occurs, with an upper bound of the number of steps
- Providing client-initiated (active) input in the form of a token, which can be placed in a fixed input place of the GN
- Providing server-initiated (passive) input in the form of a string or double value with a query string
- Client or server initiated halting of the execution
- Error reporting from the TS on all requests
General principles
GNTP uses the design of the Hypertext Transfer Protocol for the presentation layer and XML for the application layer. GNTP messages are requests (issued by the client) and responses (issued by the server). Each message consists of the message preamble (protocol version and method name or response code), optional message headers and message body. The message body, if non-empty, is usually an XML document. The namespace used by the XML documents is the GN definitions namespace: http://www.clbme.bas.bg/GN, which is defined in the following XML schema.
A request to the TS should be formed according to the following template:
<GNTP-request> ::= GNTP/<protocol-version>\r\n <method-name> <method-parameters>\r\n (<header>\r\n)* \r\n <request-body> <protocol-version> ::= <decimal-digit>.<decimal-digit> <method-name> ::= <capital-latin-letter> | <capital-latin-letter><method-name> <method-parameters> ::= <decimal-number> | <decimal-number> <method-parameters> <header> ::= <header-name>: <header-value>
The GNTP headers will be presented in Headers. The method syntax will be presented in Methods. A response from the TS should be formed according to the following template:
<GNTP-response> ::= GNTP/<protocol-version>\r\n <response-code> <response-details>\r\n (<header>\r\n)* \r\n <response-body> <response-code> ::= <response-class><response-type> <response-class> ::= <decimal-digit> <response-type> ::= <decimal-digit><decimal-digit> <response-details> ::= <ANSI-string>
The response codes and details will be presented in Response codes.
Headers
Content-Length
- Syntax
Content-Length: <decimal-number>
- Description
- Specifies the size of the message body in bytes. This header SHOULD be used in requests and responses every time, when the message body is nonempty.
- Example
Content-Length: 173
Content-Type
- Syntax
Content-Type: <media-type>
- Description
- Specifies the media type (MIME type) of the message body. This header is optional, if not specified "text/xml" type is presumed by default.
- Note: only XML messages are supported up to now.
- Example
Content-Type: text/xml
Methods
INIT
- Syntax
INIT
- Description
- The INIT method should be the first method, which a client should use. A client should use the INIT method to send a GN definition to the server. Only one INIT method should be sent to the server by the client. Each new GN execution requires a new connection to the server. The message body is an XML definition of a generalized net starting with a
<gn>
element and conforming to GNschema.xsd.
- Example
GNTP/0.1
INIT
Content-Length: 492
<?xml version = "1.0"?>
<gn xmlns = "http://www.clbme.bas.bg/GN" name = "MinimalGN">
<transitions>
<transition id = "Z1">
<inputs>
<input ref = "L1"/>
</inputs>
<outputs>
<output ref = "L2"/>
</outputs>
<predicates/>
</transition>
</transitions>
<places>
<place id = "L1" priority = "1"/>
<place id = "L2" priority = "1"/>
</places>
<tokens/>
<functions/>
</gn>
- Comment
- A minimal GN is loaded in the server.
HALT
- Syntax
HALT
- Description
- Clients should use the HALT method to initiate halt of the GN execution. The client has to wait for the server to respond and close the connection. The HALT method should be used only after an INIT method. The HALT method does not require a message body.
- Example
GNTP/0.1
HALT
- Comment
- The current GN execution is halted and the memory for the GN is freed.