English

In this section, you will create a new ASN.1 Module in the ASN.1 project we previous created.

  1. In the Package Explorer view, select the source folder and click the menu item File > New > Other....
  2. Select ASN.1 Module then click Next to start the New ASN.1 Module wizard:

    New ASN.1 Module wizard

    On this page, type "MyHTTP" in the Module name field. Then click Finish.
  3. The new file is opened in the editor. It contains the new module, and comments.
  4. Enter the following content in the opening editor.
    MyHTTP DEFINITIONS
    AUTOMATIC TAGS ::=
    BEGIN
    
       GetRequest ::= SEQUENCE {
          header-only   BOOLEAN,
          lock          BOOLEAN,
          accept-types  AcceptTypes,
          url           Url,
          ...,
          timestamp     GeneralizedTime
       }
    
       AcceptTypes ::= SET {
          standards   BIT STRING { html(0), plain-text(1), gif(2), jpeg(3) } (SIZE(4)) OPTIONAL,
          others      SEQUENCE OF VisibleString (SIZE(4)) OPTIONAL
       }
    
       Url ::= VisibleString (FROM("a".."z"|"A".."Z"|"0".."9"|"./-_~%#"))
    
       myRequest GetRequest ::= {
          header-only  TRUE,
          lock         FALSE,
          accept-types {
             standards { html, plain-text }
          },
          url          "www.asnlab.org",
          timestamp    "20121221121221Z"
       }
    
    END
  5. Save the file.

Next Section: 打开ASN.1编辑器