Presentation is loading. Please wait.

Presentation is loading. Please wait.

Abstract Syntax Notation Computer Networks courses Villanova University.

Similar presentations


Presentation on theme: "Abstract Syntax Notation Computer Networks courses Villanova University."— Presentation transcript:

1 Abstract Syntax Notation Computer Networks courses Villanova University

2 Platform and language independence 4 The purpose of ASN.1 is to allow specification of an information exchange between cooperating parts of a distributed application, independent of the platform and language used for implementation

3 ASN.1 Shared Representation Application Source Code Java Application Source Code C Abstract Specification ASN.1 Compiler Application Process in System A Application Process in System B Compatible information flow Site ASite B

4 Abstract Syntax 4 Represent the data types and structures 4 Separate definition of the transfer syntax allows interaction

5 Modules and Assignments 4 Module is the fundamental unit –name a collection of type definitions and/or value definitions (assignments)

6 Example module (A type definition) InventoryList {1 2 0 0 6 1} DEFINITIONS ::= BEGIN { ItemId ::= SEQUENCE { partnumberIA5String, quantityINTEGER, wholesalepriceREAL, salepriceREAL } StoreLocation ::= ENUMERATED { Baltimore (0), Philadelphia (1), Washington (2), } } END The words Baltimore, Philadelphia, and Washington are used to represent the values 0, 1, 2 for this type.

7 Type Assignment 4 Type reference (name of the type) 4 ::= 4 type 4 comments begin with -- and end with EOL or --

8 Value Assignment 4 Value reference (name of the value) 4 ::= 4 valid value notation 4 value reference must begin with lower case letter

9 Simple types 4 BOOLEAN (true or false) 4 INTEGER (any positive or negative whole number or zero) 4 REAL (mantissa, base, exponent) 4 BIT STRING (ordered string of bits) 4 OCTET STRING (ordered string of octets) 4 NULL (null is the only allowed value) 4 OBJECT IDENTIFIER (identifies a place in a tree) 4 ENUMERATED (a list of names of values) 4 CHARACTER STRING (several are defined)

10 Structured Types 4 SEQUENCE/SEQUENCE OF –An ordered collection; “of” indicates all entries are the same type 4 SET/SET OF –an unordered collection; “of” indicates entries are the same type 4 CHOICE –collection of types from which one is chosen 4 SELECTION –references a CHOICE type

11 Tagging 4 When one of several types might be transmitted at a particular time, tagging allows the receiving system to decode correctly 4 UNIVERSAL (predefined and standard Example Integer is universal tag 1, etc.) 4 APPLICATION (defined within an application) 4 PRIVATE (defined within an organization) 4 CONTEXT-SPECIFIC (locally defined)

12 Basic Encoding Rules 4 ASN.1 definitions made concrete by specific rules for encoding. 4 Basic structure: Tag, Length, Value 4 Tag: Class, simple or constructed, code –Integer: 00000001 –Class universal = 00, simple type = 0, code for integer tag = 1 –Integer value 27, shown in hexadecimal: 01011B 4 Nesting works to encode complex types tag length

13 Time 4 GeneralizedTime –Local: YYYYMMDDHHMMSS.fff –Universal:YYYYMMDDHHMMSS.fffZ –Difference: YYYYMMDDHHMMSS.fff+-HHMM –(fractions of seconds are optional) Time shift from UTCTime 4 UTCTime –same formats as above –no fff; seconds optional 4 So what time is it? Express the current time in the Generalized Time format

14 Coordinated Universal Time (UTC) Based on the second (SI). For most practical purposes UTC is equivalent to mean solar time at the prime meridian (0° longitude), formerly expressed in GMT. The second was formerly defined in terms of astronomical phenomena. The change to atomic resonance phenomena ("atomic time") to define the second more precisely.led to need for occasional adjustments in the "atomic" time scale to coordinate it with the workaday mean solar time scale, UT-1. Rotational irregularities usually result in a net decrease in the Earth's average rotational velocity, and ensuing lags of UT-1 with respect to UTC. Adjustments to the atomic, i.e., UTC, time scale consist of an occasional addition or deletion of one full second, which is called a leap second. Twice yearly, during the last minute of June 30 and December 31, Universal Time, adjustments may be made to ensure that the accumulated difference between UTC and UT-1 will not exceed 0.9 s before the next scheduled adjustment. The last minute of the UTC time scale, on the day when an adjustment is made, will have 59 or 61 seconds. Synonyms World Time, Z Time, Zulu Time. Source: http://www.its.bldrdoc.gov/fs-1037/dir-009/_1277.htm January 2001

15 Use of time standards UTC - Coordinated Universal Time Weather observations and forecasts are usually reported in UTC, which used to be known as Greenwich Mean Time (GMT), i.e. the local time at the Greenwich meridian (zero degrees longitude). This allows weather observations the world over to have the same time stamp. Since UTC is ahead of local time in the United States, sometimes weather data will have tomorrow's date, but it still represents today's data (we are not THAT good at forecasting the weather). UTC is 8 hours ahead of Pacific Standard Time (e.g. 0000 UTC is 4 p.m. PST the previous day, 1200 UTC is 4 a.m. PST the same day), 7 hours ahead of Pacific Daylight Time (e.g. 0000 UTC is 5 p.m. PDT the previous day, 1200 UTC is 5 a.m. PDT the same day). P.S. it is UTC instead of CUT to make the abbreviation language independent. Source: http://www.atmos.washington.edu/utc.html January 2001 What time is it here, as an offset from UTC?

16 If you really want to know what time it is 4 Check this site: http://www.greenwich2000.com/time/

17 SubtreeSpecification ::= SEQUENCE { base [0] LocalName DEFAULT { }, COMPONENTS OF ChopSpecification, specificationFilter [4] Refinement OPTIONAL } -- empty set specifies whole administrative area LocalName ::= RDNSequence ChopSpecification ::= SEQUENCE { specificExclusions [1] SET OF CHOICE { chopBefore [0] LocalName, chopAfter [1] LocalName } OPTIONAL, minimum [2] BaseDistance DEFAULT 0, maximum [3] BaseDistance OPTIONAL } BaseDistance ::= INTEGER (0.. MAX) Refinement ::= CHOICE { item [0] OBJECT-CLASS.&id, and [1] SET OF Refinement, or [2] SET OF Refinement, not [3] Refinement } Source ( January 2001): ftp://ftp.bull.com/pub/OSIdirectory/2ndEditionSpecifications/ASN.1modules/compilableASN.1 Part of an example specification in ASN.1

18 Current uses of ASN.1 4 Every call placed on a cellular telephone in North America, Europe, and Japan results in TCAP protocol messages. These messages, described using ASN.1 and encoded using one its predefined encoding rules (e.g., The Basic Encoding Rules (BER) 4 Also, routing of 800- number calls, reverse charging, other special phone services all are defined using ASN.1 messages See http://www.oss.com/asn1/overview.html for further information

19 Java classes for ASN.1 Class iaik.asn1.ASN java.lang.Object | +----iaik.asn1.ASN public class ASN extends java.lang.Object implements java.lang.Cloneable The ASN class represents the ASN.1 types. These types are represented at the Java level with ASN.XXX literals. This class also acts as an factory for creating ASN.1 OBJECT subclasses for various kinds of Java objects. Each new created ASN.1 type has to be registered in the factory by specifying the class that implements the particular ASN.1 type. Source: (January 2001) http://www.cs.utexas.edu/users/dragon/cs378/f98/resources/iaikdocs/iaik.asn1.ASN.html

20 Exercises 4 Chapter 3 of Cassel/Austing Computer Networks –page 103-104, # 10, 11


Download ppt "Abstract Syntax Notation Computer Networks courses Villanova University."

Similar presentations


Ads by Google