ASN.1 Compiler for text-based protocols! Raman Govindan Software Consultant, Wipro Technologies

advertisement
International Telecommunication Union
ASN.1 Compiler for
text-based protocols!
Raman Govindan
Software Consultant, Wipro Technologies
ITU-T and ITU-D Workshop
Bangalore (India), 30-31 August 2001
AGENDA
o
o
o
o
o
31.05.2016
What is ASN.1 Compiler?
Components of ASN.1 Compiler
Example of ASN.1 Specification
Working of ASN.1 Compiler
Case Study
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
2
What is ASN.1 Compiler?
o
o
ASN.1 Compiler is a tool to convert the
data description in ASN.1 format to
programming language dependent data
structures and associated routines to
encode/decode the same.
Two approaches to generate
encode/decode routines
•
•
31.05.2016
dedicated routines per message
generic routines (which is considered for
the rest of the presentation)
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
3
ASN.1 Compiler Components
ASN.1
specification
Input Validation
and Parsing
Header
File
ASN.1 Encode
Encoded
bytes
31.05.2016
Driving
Table
ASN.1 Decode
Decoded
Data
Network
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
4
ASN.1 Example
A ::= SEQUENCE {
b BOOLEAN
c
C
d D
e
INTEGER
}
C ::= SEQUENCE {
c
BOOLEAN
e
INTEGER
}
D ::= SEQUENCE {
e INTEGER
}
31.05.2016
typedef struct {
char
b;
C
c;
D
d;
int
e;
} A;
typedef struct {
char
c;
int
e;
} C;
typedef struct {
int
e;
} D;
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
5
Wipro ASN.1 Compiler Front-End Working
B
I
A
C
B
Info B; Info I;
31.05.2016
BOOLEAN
INTEGER
D
I
Info C; Info D; Info A;
&B, &I &I,
&B, &C, &D, &I
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
6
Wipro ASN.1 Compiler Back-End Working
Driving Table
B
I
C
D
A
ROOT
SEQUENCE
4
BB CC DD II
SEQUENCE
2
1
BB I I
Encoded
Bit
stream
BOOLEAN
INTEGER
typedef struct {
char
b;(1)
C
c;
D
d;
int
e;(5)
} A;
typedef struct {
char
c;(0)
int
e;(2)
} C;
typedef struct {
int
e;(3)
} D;
1 0 2 3 5
31.05.2016
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
7
Footprint of various
alternatives.
Units are in KB
31.05.2016
H.323
H.225
H.245
RAS
Table Driven Approach
Dedicated Routines
Q.931
160
140
120
100
80
60
40
20
0
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
8
Advantages of text-based
protocols and how ASN.1
Tools help achieve the same.
o
easy implementation
ASN.1 Compiler eases implementation
o
easy debugging
ASN.1 Compiler trace facility for debug
o
similar parser implementation available
ASN.1 Compiler generates code.
o
high extensibility
ASN.1 support extension elements
31.05.2016
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
9
Case Study
Text-based
ASN.1-based
o Case study is on a comparative study of
text-based versus ASN.1-based protocol
o extract of text-based protocol and its
equivalent ASN.1 representation is taken as
reference for the study.
31.05.2016
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
10
Extract of Text-based protocol
time-fields
= 1*( "t=" start-time space stop-time
*(CRLF repeat-fields) CRLF)
[zone-adjustments CRLF]
repeat-fields
= "r=" repeat-interval space typed-time
1*(space typed-time)
zone-adjustments = time space ["-"] typed-time
*(space time space ["-"] typed-time)
start-time
= time | "0"
stop-time
= time | "0"
time
= POS-DIGIT 9*(DIGIT)
;sufficient for 2 more centuries
repeat-fields
= "r=" repeat-interval space typed-time
1*(space typed-time)
repeat-interval
= typed-time
typed-time
= 1*(DIGIT) [fixed-len-time-unit]
fixed-len-time-unit = "d" | "h" | "m" | "s"
zone-adjustments = time space ["-"] typed-time
*(space time space ["-"] typed-time)
31.05.2016
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
11
Equivalent ASN.1 Representation
TimeFields ::= SEQUENCE {
timeFields
SEQUENCE OF TimeField
zoneAdjustments
ZoneAdjustments OPTIONAL
}
TimeField ::= SEQUENCE {
startTime NTPTimeStamp Optional -- Optional means 0
stopTime NTPTimeStamp Optional -- Optional means 0
repeatFields SEQUENCE OF RepeatField OPTIONAL
}
NTPTimeStamp ::= INTEGER(1000000000..4294967295)
positiveNegativeNTPTimeStamp ::=
INTEGER(1000000000..4294967295)
repeatFields ::= SEQUENCE {
repeatInterval
typedTime
duration
typedTime
offset
SEQUENCE OF typedTime
}
31.05.2016
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
12
Equivalent ASN.1 Representation . . .
zoneAdjustements ::= SEQUENCE {
time NTPTimeStamp
adjust positiveNegativetypedTime
}
typedTime ::= CHOICE {
ntpTimeStamp NTPTimeStamp
days
INTEGER (1..73050)
-- Two centuries
hours
INTEGER (1..8784)
-- One year
minutes
INTEGER (1..527040)
-- One year
seconds
INTEGER (1..31622400) -- One year
}
positiveNegativetypedTime ::= CHOICE {
ntpTimeStamp
positiveNegativeNTPTimeStamp
days
INTEGER(-73050..73050)
hours
INTEGER(-8784..8784)
minutes
INTEGER(-527040..527040)
seconds
INTEGER(-31622400..31622400)
}
31.05.2016
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
13
Benchmark Results
Text-based
ASN.1-based
o 2800 Encoding o
o
o
o
31.05.2016
1micro-seconds
280 Decoding - 1microseconds
Is there a tool to
optimize parsergenerated code?
Footprint is 100KB for
entire grammar which
includes the one in this
case study.
Text compression can
be used for efficient
bandwidth at the
expense of
performance
o 23000 Encoding -
1micro-seconds
o 22000 Decoding 1micro-seconds
o Optimized ASN.1
Compiler leads to
easier development
o Footprint is 45KB
o PER can be used for
efficient bandwidth
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
14
Hurdles to ASN.1-based
protocol
o
Availability of limited free ASN.1 tools
Contribute more and more tools in public
domain.
Tool to convert BNF to ASN.1 representation
will promote text-based evangelists to
consider ASN.1-based protocols.
31.05.2016
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
15
One Application of ASN.1
VoiceEngine for RG
Bluetooth
ASN.1 is
used here
Wipro VoiceEngine
H323-NCS GW
Home LAN
HFC out
Settop Box,
Home Gateway,
LAN Access Point
SIP
C
M E’net /
Cable
Modem
HFC OUT
USB
H.323
visit us at http://www.wipro.com/homenet
VoiceEngine Software provides the Voice Over Cable Capability to the device
31.05.2016
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
16
Thank You
visit us at http://www.wipro.com/homenet
31.05.2016
ITU-T and ITU-D Workshop - Bangalore (India), 30-31 August 2001
17
Download