[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: about ASN.1



At 02:25 PM 11/30/99 +0800, cellecial@21cn.com wrote:
>1) Is LDAP a protocol of application layer?

In terms of the Internet Layering Model which provides
four conceptual layers: Application, Transport, Internet,
and Network Interface), yes.

In terms of the ISO Model, LDAP is provides functionality
at both presentation and application layers.  One could
consider the encoding/decoding of the ASN.1 described data
as being at the presentation layer and the semantics of
LDAP operations as being at the application layer.

>2) In rfc2251,protocol is described using ASN.1,such as:

RFC2251 describes LDAPv3.  RFC1777 describes LDAPv2.
Both are similiar in regard to the AddRequest description.

> AddRequest::=[APPLICATION 8] SEQUENCE {
>        entry           LDAPDN,
>        attributes      AttributeList  }
> LDAPDN::=LDAPString
> 
> AttributeList::=SEQUENCE OF SEQUENCE {
>        type            AttributeDescription,
>        vals            SET OF AttributeValue }
> AttributeDescription::=LDAPString
> AttributeValue::=OCTEC STRING
> LDAPString::=OCTET STRING
>
>I think when I implement AddRequest, I should presentation
>it as:

You should provide the data needed in a form understood
by the API you are using.  The LDAP C API (RFC 1823, an
update is being worked on by IETF LDAPext WG) uses the
following interface:
  int ldap_add( LDAP *ld, char *dn, LDAPMod *attrs[] );

where LDAPMod is a structure which contains a sequence
of attributes with a type and one or more values.
  
>Is that right?

Conceptually or in practice?  In either case, the structures
you offer are flawed.

>But in openldap source code,I can't find
>where define AddRequest and other protocol elements(such as
>LDAPMessage,DeleteRequest,AddRequest,and so on).

The source code doesn't require specific structures for
these protocol elements.  It directly encodes information
provided by the caller into a BerElement for transmission
to the server.

>>From ldap.h , I can find the definition of ldapmsg:
>But I think it is different with LDAPMessage in rfc2251,

Yes, it's an internal structure used to represent an LDAP
message coming from the server.  The API client should treat
this structure as being opaque.

>Who can explain how OpenLDAP implement rfc2251?

OpenLDAP 1.x actually implements RFC 1777, so:

	Who can explain how OpenLDAP implements rfc1777?

It uses protocol layering.  -lldap deals with LDAP
semantics, -llber deals with encoding and decoding of
messages.

For more details of OpenLDAP design, see U-Mich design
documents at: http://www.umich.edu/~dirsvcs/ldap/doc/
(OpenLDAP is derived from U-Mich).