-->

ASN.1 module description

2019-07-18 11:28发布

问题:

I tried to use ASN.1 for a client server communication, but i'm not sure that i understand it correctly . The Client have to send an integer to the server, the server read it and send back a number and a String, the Client read them and send back a String the server read it and send back a String. It's something like this.

Client ---> server 1 integer

Server --> Client 1 integer
Server --> Client 1 String

Client ---> server 1 String
Server --> Client 1 String

I wrote the following ASN.1 module, I succeeded to generate the classes with jac asn1 but I am not sure that the description of the module are correct because the two sequence are exactly the same. I m not sure if i have to put only the variable that i will send or recive or both.

Demo-module DEFINITIONS ::=       -- Module-name DEFINITIONS ::= BEGIN

BEGIN

Client ::= SEQUENCE {

clientInt INTEGER ,

serverInt INTEGER ,

serverString BIT STRING ,

clientString BIT STRING , serverResponse BIT STRING

}

Server ::= SEQUENCE {

clientInt     INTEGER ,                 

serverInt INTEGER ,

serverString BIT STRING ,

clientString BIT STRING , serverResponse BIT STRING

}

END -- end of module, END required

标签: java c asn.1