mozldap.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * mozldap does not have all the openldap "ber" functions, like ber_skip_element.
  3. * So we need to directly parse the ber element, and see inside the ber struct.
  4. * From lber-int.h
  5. */
  6. typedef struct seqorset {
  7. ber_len_t sos_clen;
  8. ber_tag_t sos_tag;
  9. char *sos_first;
  10. char *sos_ptr;
  11. struct seqorset *sos_next;
  12. } Seqorset;
  13. #define SOS_STACK_SIZE 8 /* depth of the pre-allocated sos structure stack */
  14. #define MAX_TAG_SIZE (1 + sizeof(ber_int_t)) /* One byte for the length of the tag */
  15. #define MAX_LEN_SIZE (1 + sizeof(ber_int_t)) /* One byte for the length of the length */
  16. #define MAX_VALUE_PREFIX_SIZE (2 + sizeof(ber_int_t)) /* 1 byte for the tag and 1 for the len (msgid) */
  17. #define BER_ARRAY_QUANTITY 7 /* 0:Tag 1:Length 2:Value-prefix 3:Value 4:Value-suffix */
  18. struct berelement {
  19. ldap_x_iovec ber_struct[BER_ARRAY_QUANTITY]; /* See above */
  20. char ber_tag_contents[MAX_TAG_SIZE];
  21. char ber_len_contents[MAX_LEN_SIZE];
  22. char ber_pre_contents[MAX_VALUE_PREFIX_SIZE];
  23. char ber_suf_contents[MAX_LEN_SIZE+1];
  24. char *ber_buf; /* update the value value when writing in case realloc is called */
  25. char *ber_ptr;
  26. char *ber_end;
  27. struct seqorset *ber_sos;
  28. ber_len_t ber_tag_len_read;
  29. ber_tag_t ber_tag; /* Remove me someday */
  30. ber_len_t ber_len; /* Remove me someday */
  31. int ber_usertag;
  32. char ber_options;
  33. char *ber_rwptr;
  34. BERTranslateProc ber_encode_translate_proc;
  35. BERTranslateProc ber_decode_translate_proc;
  36. int ber_flags;
  37. #define LBER_FLAG_NO_FREE_BUFFER 1 /* don't free ber_buf */
  38. unsigned int ber_buf_reallocs; /* realloc counter */
  39. int ber_sos_stack_posn;
  40. Seqorset ber_sos_stack[SOS_STACK_SIZE];
  41. };
  42. typedef struct berelement MozElement;