首页 | 新闻资讯 | 培训认证 | 安全管理 | 病毒分析 | 安全协议 | 网络安全 | 防火墙 | 黑客技术
DB安全 | Web安全 | 入侵检测 | 安全审计 | 设备安全 | 备份恢复 | 安全标准 | 法律法规 | 无线安全
OS安全 | PKI与PMI | 病毒防治 | 隔离网闸 | XML安全 | 网管专区 | 经典案例 | 技术论坛 |  
+ 文章搜索 +
当前位置:首页>>PKI与PMI>>ANS.1编码>>正文
关键字:
范 围:
※热点文章※
·ASN.1简介(1)
※推荐文章※
·ASN.1简介(1)
ASN.1简介(2)
作者: 文章出处:http://asn1.elibel.tm.fr/en/ 发布时间:2005-06-25 点击:
Case study
 
Suppose a company owns several sales outlets linked to a central warehouse where stocks are maintained and deliveries start from. The company requires that its protocol have the following features:
  • the orders are collected locally at the sales outlets ;
  • they are transmitted to the warehouse, where the delivery procedure should be managed ;
  • an account of the delivery must be sent back to the sales outlets for following through the client's order.
This protocol can be specified with the two following ASN.1 modules:
 
   
Module-order DEFINITIONS AUTOMATIC TAGS ::=
BEGIN

Order ::= SEQUENCE {
  header  Order-header,
  items   SEQUENCE OF Order-line}

Order-header ::= SEQUENCE {
  number   Order-number,
  date     Date,
  client   Client,
  payment  Payment-method }

Order-number ::= NumericString (SIZE (12))

Date ::= NumericString (SIZE (8)) -- MMDDYYYY

Client ::= SEQUENCE {
  name     PrintableString (SIZE (1..20)),
  street   PrintableString (SIZE (1..50)) OPTIONAL,
  postcode NumericString (SIZE (5)),
  town     PrintableString (SIZE (1..30)),
  country  PrintableString (SIZE (1..20))
               DEFAULT default-country }
default-country PrintableString ::= "France"

Payment-method ::= CHOICE {
  check        NumericString (SIZE (15)),
  credit-card  Credit-card,
  cash         NULL }

Credit-card ::= SEQUENCE {
  type         Card-type,
  number       NumericString (SIZE (20)),
  expiry-date  NumericString (SIZE (6)) -- MMYYYY -- }

Card-type ::= ENUMERATED { cb(0), visa(1), eurocard(2),
                 diners(3), american-express(4) }

Order-line ::= SEQUENCE {
  item-code    Item-code,
  label        Label,
  quantity     Quantity,
  price        Cents }

Item-code ::= NumericString (SIZE (7))

Label ::= PrintableString (SIZE (1..30))

Quantity ::= CHOICE { unites       INTEGER,
                      millimetres  INTEGER,
                      milligrammes INTEGER }

Cents ::= INTEGER

Delivery-report ::= SEQUENCE {
  order-code   Order-number,
  delivery     SEQUENCE OF Delivery-line }

Delivery-line ::= SEQUENCE { item  Item-code,
                             quantity Quantity }

END

Protocol DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
IMPORTS Order, Delivery-report, Item-code, Quantity, 
        Order-number FROM Module-order ;

PDU ::= CHOICE { question CHOICE { 
                   question1 Order,
                   question2 Item-code,
                   question3 Order-number,
                   ... },
                 answer  CHOICE {
                   answer1   Delivery-report,
                   answer2   Quantity,
                   answer3   Delivery-report,
                   ... }}
END
返回顶部↑】 【推荐好友】 【查看评论
用户名: 新注册) 密码: 匿名评论 [查看评论] 发表评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
  Copyright © 2004-2005 infosecurity.org.cn . All Rights Reserved
版权所有:中国信息安全组织 系统管理:webmaster@infosecurity.net.cn
本站部分资源来自互联网,如有侵犯您的版权或其他问题,请通知管理员,我们会尽快处理!