Title: ASN.1 Compiler for text-based protocols!
1ASN.1 Compiler for text-based protocols!
- Raman Govindan
- Software Consultant, Wipro Technologies
2AGENDA
- What is ASN.1 Compiler?
- Components of ASN.1 Compiler
- Example of ASN.1 Specification
- Working of ASN.1 Compiler
- Case Study
3What is ASN.1 Compiler?
- 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
- dedicated routines per message
- generic routines (which is considered for the
rest of the presentation)
4 ASN.1 Compiler Components
ASN.1
specification
Input Validation
and Parsing
Header
File
Table
Decoded Data
ASN.1 Encode
ASN.1 Decode
Network
Encoded bytes
5ASN.1 Example
- typedef struct
- char b
- C c
- D d
- int e
- A
- typedef struct
- char c
- int e
- C
- typedef struct
- int e
- D
- A SEQUENCE
- b BOOLEAN
- c C
- d D
- e INTEGER
-
- C SEQUENCE
- c BOOLEAN
- e INTEGER
-
- D SEQUENCE
- e INTEGER
6Wipro ASN.1 Compiler Front-End Working
B
BOOLEAN
A
I
INTEGER
D
C
I
B
Info B Info I Info C Info D Info
A B, I I,
B, C, D, I
7Wipro ASN.1 Compiler Back-End Working
Driving Table
- 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
B
I
C
D
A
ROOT
BOOLEAN
BOOLEAN
Encoded Bit stream
INTEGER
INTEGER
INTEGER
1
2
3
0
5
8Footprint of various alternatives.
Units are in KB
160
140
120
100
80
60
40
20
0
RAS
Q.931
H.245
H.225
H.323
9Advantages of text-based protocols and how ASN.1
Tools help achieve the same.
- easy implementation
-
- easy debugging
-
- similar parser implementation available
-
- high extensibility
-
ASN.1 Compiler eases implementation
ASN.1 Compiler trace facility for debug
ASN.1 Compiler generates code.
ASN.1 support extension elements
10Case Study Text-based ASN.1-based
- Case study is on a comparative study of
text-based versus ASN.1-based protocol - extract of text-based protocol and its equivalent
ASN.1 representation is taken as reference for
the study.
11Extract 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)
12Equivalent 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
-
-
13Equivalent 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 positiveNegativeNTPTimeStam
p - days INTEGER(-73050..730
50) - hours INTEGER(-8784..8784
) - minutes INTEGER(-527040..5270
40) - seconds INTEGER(-31622400..316
22400) -
14Benchmark Results Text-based ASN.1-based
- 2800 Encoding - 1micro-seconds
- 280 Decoding - 1micro- seconds
- Is there a tool to optimize parser-generated
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
- 23000 Encoding - 1micro-seconds
- 22000 Decoding - 1micro-seconds
- Optimized ASN.1 Compiler leads to easier
development - Footprint is 45KB
- PER can be used for efficient bandwidth
15Hurdles to ASN.1-based protocol
- 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.
16One Application of ASN.1
VoiceEngine for RG
VoiceEngine for RG
ASN.1 is used here
Wipro
VoiceEngine
H323-NCS GW
HFC out
C
Settop Box,
Home Gateway,
M
HFC OUT
LAN Access Point
visit us at http//www.wipro.com/homenet
VoiceEngine Software provides the Voice Over
Cable Capability to the device
17Thank You
visit us at http//www.wipro.com/homenet