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

about ASN.1



Hi,

I have some question about rfc2251.

1) Is LDAP a protocol of application layer?

2) In rfc2251,protocol is described using ASN.1,such as:
 
 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:

        typedef struct addreq{
                char *entry,
                struct attribute}

        typedef struct attribute{
                char *type,
                char *vals,
                struct attribute *next}
        
Is that right? But in openldap source code,I can't find
where define AddRequest and other protocol elements(such as
LDAPMessage,DeleteRequest,AddRequest,and so on).
>From ldap.h , I can find the definition of ldapmsg:

typedef struct ldapmsg {
        int             lm_msgid;       /* the message id */
        int             lm_msgtype;     /* the message type */
        BerElement      *lm_ber;        /* the ber encoded message contents */
        struct ldapmsg  *lm_chain;      /* for search - next msg in the resp */
        struct ldapmsg  *lm_next;       /* next response */
        unsigned int    lm_time;        /* used to maintain cache */

But I think it is different with LDAPMessage in rfc2251,which is like:

LDAPMessage::=SEQUENCE{
        messageID       MessageID,
        protocolOp      CHOICE{
                bindRequest     BindRequest,
                bindResponse    BindResponse,
                ......          }
        controls        [0]Controls OPTIONAL}

Who can explain how OpenLDAP implement rfc2251?
Any hint would be appreciated.
                
----------------------------------------------
»¶Ó­Ê¹Óà 21CN µç×ÓÓʼþϵͳhttp://www.21cn.com
Thank you for using 21CN Email system

----------------------------------------------
»¶Ó­Ê¹Óà 21CN µç×ÓÓʼþϵͳhttp://www.21cn.com
Thank you for using 21CN Email system