RE: [ASN.1] Binary vs Text

2002-03-15 Thread Paul Long

Phil,

Yes, but Brian has a valid point in his response on the Megaco reflector,
although I think he is grasping at straws. Basically, he says that the
reason binary looks so good is that the programmers at OSS are just a lot
better at writing optimized code in general than those at Erlang. :-)
Presumably, if the same effort were applied to text, the text encoding would
perform better than the binary. (...ah, it never ends...)

Paul Long
ipDialog, Inc.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Phil
 Griffin
 Sent: Friday, March 15, 2002 3:55 PM
 To: [EMAIL PROTECTED]
 Subject: [ASN.1] Binary vs Text


 Thought this would be interesting, though it
 didn't appear to be so until I followed the
 link. Very compelling reasons to consider
 compact binary encodings over verbose text.
 Binary appears to be both smaller and faster
 to process for these test cases.

 Phil




[ASN.1] TYPE-IDENTIFIER.Type

2002-06-24 Thread Paul Long

I've put it off too long. Now it's time for me learn this . stuff. Is y,
below, encoded in PER as an open type that contains an encoding of X? Is
that all there is to it? Also, what syntactical role does the (X) play? Is
this a constraint and otherwise y could be encoded as an open type of any
type?

X ::= SEQUENCE {
a INTEGER,  -- stuff...
b BOOLEAN
}

Z ::= SEQUENCE {
y TYPE-IDENTIFIER.Type (X)
}

Paul Long
ipDialog, Inc.




RE: [ASN.1] TYPE-IDENTIFIER.Type

2002-06-24 Thread Paul Long

Rajul,

Okay, thanks. So I think you're answer to my first question is, yes. :-)

Also, given X:

X ::= SEQUENCE {
a INTEGER, -- stuff...
b BOOLEAN
}

I believe that Z1:

Z1 ::= SEQUENCE {
y TYPE-IDENTIFIER.Type (X)
}

encodes in PER exactly like Z2:

Z2 ::= SEQUENCE {
y OCTET STRING  -- contains X
}

True?

Paul Long
ipDialog, Inc.

 -Original Message-
 From: Rajul Gupta [mailto:[EMAIL PROTECTED]]
 Sent: Monday, June 24, 2002 4:13 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [ASN.1] TYPE-IDENTIFIER.Type


 Hi Paul,

 (X) is a type constraints here, and it says that y MUST be of type X
 only. Syntactically, this is equivalent to

 Z ::= SEQUENCE {
y   X
 }

 However, this kind of syntax (your syntax) is useful in case of PER. PER
 always doesn't have length encoded, but while encoding open
 types, PER puts
 a length wrapper also. So if you are using PER, then at the decoding side
 you can easily find out the length of encoded open type value, without
 knowing it's type.

 Usually this type of construct is useful for security fields. Using length
 wrapper you can easily find out the length of security data and leave this
 data unwrapped and unprocessed in your application, and pass it to other
 application or function, where this security data is used.

 I hope this answer could be helpful for you.

 Rajul

  I've put it off too long. Now it's time for me learn this . stuff. Is
 y,
  below, encoded in PER as an open type that contains an encoding of X? Is
  that all there is to it?
  Also, what syntactical role does the (X) play? Is
  this a constraint and otherwise y could be encoded as an open
 type of any
  type?
  X ::= SEQUENCE {
  a INTEGER, -- stuff...
  b BOOLEAN
  }
 
  Z ::= SEQUENCE {
  y TYPE-IDENTIFIER.Type (X)
  }
 
  Paul Long
  ipDialog, Inc.
 
 
 






[ASN.1] WITH-COMPONENTS creates new type or just semantically constrains?

2002-07-17 Thread Paul Long

I have questions about inner subtyping. Given these two type definitions:

Parent ::= SEQUENCE
{
anOptionalThing INTEGER OPTIONAL,
anotherOptionalThing INTEGER OPTIONAL,
aRequiredThing INTEGER
}

Child ::= Parent WITH COMPONENTS { ..., anOptionalThing ABSENT }

does the WITH-COMPONENTS construct essentially create a new type, i.e.,

SEQUENCE
{
anotherOptionalThing INTEGER OPTIONAL,
aRequiredThing INTEGER
}

or does it merely apply a semantic constraint to the existing type, i.e.,
the anOptionalThing is still syntactically OPTIONAL  but its _value_ is
constrained to not be present? For a PER encoding, the question could be
stated as, is there a presence bit (set to 0) in the bit-map preamble for
the anOptionalThing component, or is even its presence bit absent?

Likewise, would this:

Child ::= Parent WITH COMPONENTS { ..., anOptionalThing PRESENT }

result in this new type:

SEQUENCE
{
anOptionalThing INTEGER,
anotherOptionalThing INTEGER OPTIONAL,
aRequiredThing INTEGER
}

Paul Long
ipDialog, Inc.




RE: [ASN.1] WITH-COMPONENTS creates new type or just semantically constrains?

2002-07-17 Thread Paul Long

John,

Okay. Whew! :-)

So for my first example, PER would encode a presence bit in the preamble
bit-map for anOptionalThing, right, even though it is constrained to be
ABSENT? And it would always be set to 0 because a value for that component
is constrained to always be absent. For my second example, the presence bit
would always be set to 1 and that component would always be present, or have
a value. This is what I thought, but a colleague questioned this, which led
me to wonder...

Thanks!

Paul

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of John
 Larmouth
 Sent: Wednesday, July 17, 2002 12:17 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [ASN.1] WITH-COMPONENTS creates new type or just
 semantically constrains?


 Paul Long wrote:

 Paul,

 I guess it depends on what you mean by a new type.  (The term is not
 actual defined in ASN.1, but is used in the introduction and in a
 normal English way when talking about defining a new type from an old
 one by tagging or subtyping.)

 The text is clear that tagging and subtyping (**all** forms of
 subtyping) do indeed produce a new type.  The text is probably
 slightly unclear on whether a simple A ::= B assignment creates a new
 type A from the old type B, but that is the intended view (the term
 new is missing from 15.1 and 16.1, but it is clear from other cases
 that a new type is intended here also).

 Whether two types are the same or different matters mainly for

   a)  the rules on when values with one type can be used
 in DEFAULT as
 values of the other type (or as actual parameters for a dummy parameter
 defined with the other type,  and

   b)  (if there is a value mapping between the two types)
 whether the
 encoding of mapped values is the same in some particular encoding rule.

 For the rules on a) you need to refer to what is colloquially called the
 semantic model.  (Formally: Rules for type and value Compatibility -
 Annex B in the 2002 version.)  For the rules on b), you need to refer to
 individual encoding rules.

 One imporant point is that for the purposes of a) above, inner subtyping
 is not treated differently from any other form of subtyping.  You *are*
 defining a new type, but value mappings exist between the old and new
 types, and values defined using one as the governor can be used as
 DEFAULT values for the other (provided they are in the mapped subset).

 Now we turn to b) above with BER:  BER totally ignores constraints. So
 the encoding of the mapped values of a constrained type are always the
 same as those of the unconstrained type.

 Now we turn to b) above with PER:  Here it is a little more complex.
 Some constraints are PER-visible (such as INTEGER (1..7) ) and affect
 the encoding. Others (including UTF8String (T | F) and inner
 subtyping) are *not* PER-visible.  What this means is that the mapped
 values encode in exactly the same way as the corresponding values in the
 unconstrained type.

 So 

 To give you a briefer answer:  Your examples are best considered as
 defining a new type (with a subset of the values of the old type), but
 with both BER and PER the encoding of the mapped values is the same for
 both the new type and the old type.

 This can actually be important for inner subtyping, as one of its main
 uses is to define a basic class message from a full class message,
 and easy interworking between full class and basic class systems clearly
 requires that encoding rules should produce the same encoding for values
 that are in both the basic class and full class messages.  They do!

 John L


 
  I have questions about inner subtyping. Given these two type
 definitions:
 
  Parent ::= SEQUENCE
  {
  anOptionalThing INTEGER OPTIONAL,
  anotherOptionalThing INTEGER OPTIONAL,
  aRequiredThing INTEGER
  }
 
  Child ::= Parent WITH COMPONENTS { ..., anOptionalThing ABSENT }
 
  does the WITH-COMPONENTS construct essentially create a new type, i.e.,
  SEQUENCE
  {
  anotherOptionalThing INTEGER OPTIONAL,
  aRequiredThing INTEGER
  }
 
  or does it merely apply a semantic constraint to the existing
 type, i.e.,
  the anOptionalThing is still syntactically OPTIONAL  but its _value_ is
  constrained to not be present? For a PER encoding, the question could be
  stated as, is there a presence bit (set to 0) in the bit-map
 preamble for
  the anOptionalThing component, or is even its presence bit absent?
 
  Likewise, would this:
 
  Child ::= Parent WITH COMPONENTS { ..., anOptionalThing PRESENT }
 
  result in this new type:
 
  SEQUENCE
  {
  anOptionalThing INTEGER,
  anotherOptionalThing INTEGER OPTIONAL,
  aRequiredThing INTEGER
  }
 
  Paul Long
  ipDialog, Inc.

 --
Prof John Larmouth
Larmouth TPDS Ltd
(Training and Protocol Development Services)
1 Blueberry Road
Bowdon   [EMAIL PROTECTED