MMS的ASN.1规定( 8825-1 BER 8825-2 PER )

  8  7   6  5  4  3  2  1         +        Length        +       Content
-------------------------------------------------------------------------
|Class |X |      Tag    |                                                |             
-------------------------------------------------------------------------          
Class:   
0 0 Universal
0 1 Application
1 0 Context-speciatic:指Type不需传送,双方约定 IMPLICIT
1 1 prviate

X :
0 ---- primitive   -----指定:content without a Structure 只有 1个Length 1个Content
1 ---- contructed  -----指定:content with addition structure
                            (如squence,squence of , implicit squence ,implicit squence of )
                            (Type , Length ,Content )任意个嵌套T-L-C
Tag:
ASN.1中Tag可能超过5个Bits,但是MMS中不会出现

Length: 指Content的长度。可以任意长度, 

例子:
1.单个OCTET STRING (ASN.1 key word )
Type (= OCTET STRING), Length (= 5 Octets) and Content (= 24 65 4F EF F3 hex)
 T  L  C
 -  -  --------------
 04 05 24 65 4F EF F3
 
2.有上下文中的[2]IMPLICIT OCTET STRING (多[2]IMPLICIT )
 T  L  C
 -  -  --------------
 82 05 24 65 4F EF F3
 --            
 1 0 0 0 0 0 1 0  05  24 65 4F EF F3
 ---   ---------
 1 0 : Context-speciatic
 0 0 0 1 0: 02 primitive , value = 2
 
 3.有上下文中的[2] OCTET STRING (多个[2] 无关键字IMPLICIT )
  T     L  C
           -----------------------
           T    L   C
           -    -   --------------
  82   07  04   05  24 65 4F EF F3
           -----------------------> OCTET STRING
 
 82:
  1 0 1 0 0 0 1 0
  --- - ---------
  1 0 : Context-speciatic
  1   : constructed
 
The DER are particularly advisable for the coding of short messages; 适合短消息
the CER are suitable for very long messages 适合长消息    

The "A0" in the first line says that it is a MMS definition
(A = 1010 hex for the first four bits of the ASN.1 types - context-specific and constructed).
The "0" is the tag that contains the number in square brackets on the right. 

数据映射到MMS

ICCP (具体到购买何种Block)
ICCP Server ObjectS
1.Association
2.Data Value
3.Data Set
4.Transfer Set
5.Account             
6.Device
7.Program
8.Event
9.Conformance Blocks and Associated Objects 
9-1 Block 1 (Periodic Power System Data)保护事项对象是可选的
    Indication Point Object、 Status Points、Analog Points、Quality Codes
    Time Stamp、COV Counter、Protection Equipment Event Object
   
9-2 Block 2 (Extended Data Set Condition Monitoring)
    主要是用来report-by-exception, or RBE,以节省带宽。
   
9-3 Block 3 (Block Data Transfer) 
    主要用来如何利用ASN.1节省传送字节
   
9-4 Block 4 (Information Messages)
9-5 Block 5 (Device Control)
9-6 Block 6 (Program Control)
9-7 Block 7 (Event Reporting)    
9-8 Block 8 (Additional User Objects)
9-9 Block 9 (Time Series Data)

Three TASE.2 operations are defined for use in managing associations: Associate, Conclude, and Abort
Associate:用在客户端,用来跟服务器建立联系。 Conclude, Abort服务器、客户端均可用。

数据传送机制
a) One Shot Data
b) Periodic Data
c) Event Data
d) Exception Data(如不变不送,... ... )

Direct-Control (NonSBO)noninterlocked
Select-Before-Operateinterlocked. (SBO) 带选择控制 

包含tag的service or data
-------------------------------
尚未知道的tag?????
#define AARE_apdu1 0x61
#define AARQ_apdu0 0x60
#define ABRT_apdu4 0x64
#define RLRE_apdu3 0x63
#define RLRQ_apdu2 0x62

#define acse_result_diagnostic3 0xa3
#define acse_result2         0xa2
#define acse_service_user1     0xa1

Data ::= CHOICE {                                     
 -- context tag 0 is reserved for AccessResult         
 IF ( str1 )                                           
  array       [1] IMPLICIT SEQUENCE OF Data,                  
 ELSE                                                  
  array       [1] IMPLICIT NULL,                              
 ENDIF                                                 
 IF ( str2 )                                           
  structure   [2] IMPLICIT SEQUENCE OF Data,              
 ELSE                                                  
  structure   [2] IMPLICIT NULL,                          
 ENDIF                                                 
  boolean  [3] IMPLICIT BOOLEAN,                         
  bit-string  [4] IMPLICIT BIT STRING,                   
  integer     [5] IMPLICIT INTEGER,                         
  unsigned    [6] IMPLICIT INTEGER, -- shall not be negative
  floating-point [7] IMPLICIT FloatingPoint,            
             --  [8] is reserved                                    
  octet-string   [9] IMPLICIT OCTET STRING,               
  visible-string [10] IMPLICIT VisibleString,           
  generalized-time [11] IMPLICIT GeneralizedTime,       
  binary-time      [12] IMPLICIT TimeOfDay,                  
  bcd              [13] IMPLICIT INTEGER, -- shall not be negative   
  booleanArray     [14] IMPLICIT BIT STRING,                
  objId            [15] IMPLICIT OBJECT IDENTIFIER,                
  ...,                                                  
  mMSString        [16] IMPLICIT MMSString                     
}              

GetNameList-Request ::= SEQUENCE {
 objectClass [0] ObjectClass,
 objectScope [1] CHOICE {
 vmdSpecific [0] IMPLICIT NULL,
 domainSpecific [1] IMPLICIT Identifier,
 aaSpecific     [2] IMPLICIT NULL },
 continueAfter  [2] IMPLICIT Identifier OPTIONAL }
GetNameList-Response ::= SEQUENCE {
 listOfIdentifier [0] IMPLICIT SEQUENCE OF Identifier,
 moreFollows      [1] IMPLICIT BOOLEAN DEFAULT TRUE } 

AcknowledgeEventNotification-Request ::= SEQUENCE {
 eventEnrollmentName          [0] ObjectName,
 acknowledgedState            [2] IMPLICIT EC-State,
 timeOfAcknowledgedTransition [3] EventTime } 
 
ConfirmedServiceRequest包含很多choice

flex ,yacc/bison 的脚本???   

RFC1006
主要描述ISO 高4层利用TCP/IP的传输层功能来进行传输,实现ISO
具体描述各种原语TP和TCP的对应关系

参考文档:
Transport service  [ISO8072]
Transport protocol [ISO8073]        

In order to achieve good performance, the default TPDU size is
65531 octets, instead of 128 octets. In order to negotiate a
smaller (standard) TPDU size, the negotiation mechanism
specified in [ISO8073] is used
连接利用TCP 102端口

TCP TP最大区别:TCP包是流式的,没有边界
               TP发送的是离散的对象(NSDUs).  
TP0
TP4
 initiate negotiation初始化需要商讨的东西(Vendor需发布的东西)

CASM
ASCE