2 * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7 * Written by: Kurt Zeilenga
9 * This program is designed to test API features of libldap.
11 * The API specification can be found in:
13 * draft-api-ldapext-ldap-c-api-01.txt
15 * and discussions on ietf-ldapext mailing list.
27 main(int argc, char **argv)
33 #ifdef LDAP_API_INFO_VERSION
34 api.ldapai_info_version = LDAP_API_INFO_VERSION;
36 api.ldapai_info_version = 1;
39 printf("Compile time API Information\n");
40 printf(" API Info version: %d\n", api.ldapai_info_version);
41 printf(" API version: %d\n", LDAP_API_VERSION);
43 printf(" Protocol Version: %d\n", LDAP_VERSION);
45 printf(" Protocol Version: unknown\n");
47 #ifdef LDAP_VERSION_MIN
48 printf(" Protocol Min: %d\n", LDAP_VERSION_MIN);
50 printf(" Protocol Min: unknown\n");
52 #ifdef LDAP_VERSION_MAX
53 printf(" Protocol Max: %d\n", LDAP_VERSION_MAX);
55 printf(" Protocol Max: unknown\n");
57 #ifdef LDAP_VENDOR_NAME
58 printf(" Vendor Name: %s\n", LDAP_VENDOR_NAME);
60 printf(" Vendor Name: unknown\n");
62 #ifdef LDAP_VENDOR_VERSION
63 printf(" Vendor Version: %d\n", LDAP_VENDOR_VERSION);
65 printf(" Vendor Version: unknown\n");
68 if(ldap_get_option(NULL, LDAP_OPT_API_INFO, &api) != LDAP_SUCCESS) {
69 fprintf(stderr, "%s: ldap_get_option(api) failed\n", argv[0]);
73 printf("\nExecution time API Information\n");
74 printf(" API Info version: %d\n", api.ldapai_info_version);
76 if (api.ldapai_info_version != LDAP_API_INFO_VERSION) {
77 printf(" API INFO version mismatch!\n");
81 printf(" API Version: %d\n", api.ldapai_api_version);
82 printf(" Protocol Max: %d\n", api.ldapai_protocol_version);
84 if(api.ldapai_extensions == NULL) {
85 printf(" Extensions: none\n");
89 for(i=0; api.ldapai_extensions[i] != NULL; i++) /* empty */;
90 printf(" Extensions: %d\n", i);
91 for(i=0; api.ldapai_extensions[i] != NULL; i++) {
92 #ifndef LDAP_API_FEATURE_INFO
94 api.ldapai_extensions[i]);
96 LDAPAPIFeatureInfo fi;
97 fi.ldapaif_name = api.ldapai_extensions[i];
98 fi.ldapaif_version = 0;
100 ldap_get_option(NULL, LDAP_OPT_API_FEATURE_INFO, &fi);
103 api.ldapai_extensions[i], fi.ldapaif_version);
108 printf(" Vendor Name: %s\n", api.ldapai_vendor_name);
109 printf(" Vendor Version: %d\n", api.ldapai_vendor_version);
111 printf("\nExecution time Default Options\n");
113 if(ldap_get_option(NULL, LDAP_OPT_DEREF, &ival) != LDAP_SUCCESS) {
114 fprintf(stderr, "%s: ldap_get_option(api) failed\n", argv[0]);
117 printf(" DEREF: %d\n", ival);
119 if(ldap_get_option(NULL, LDAP_OPT_SIZELIMIT, &ival) != LDAP_SUCCESS) {
120 fprintf(stderr, "%s: ldap_get_option(sizelimit) failed\n", argv[0]);
123 printf(" SIZELIMIT: %d\n", ival);
125 if(ldap_get_option(NULL, LDAP_OPT_TIMELIMIT, &ival) != LDAP_SUCCESS) {
126 fprintf(stderr, "%s: ldap_get_option(timelimit) failed\n", argv[0]);
129 printf(" TIMELIMIT: %d\n", ival);
131 if(ldap_get_option(NULL, LDAP_OPT_REFERRALS, &ival) != LDAP_SUCCESS) {
132 fprintf(stderr, "%s: ldap_get_option(referrals) failed\n", argv[0]);
135 printf(" REFERRALS: %s\n",
136 ival == (int) LDAP_OPT_ON ? "on" : "off");
138 if(ldap_get_option(NULL, LDAP_OPT_RESTART, &ival) != LDAP_SUCCESS) {
139 fprintf(stderr, "%s: ldap_get_option(restart) failed\n", argv[0]);
142 printf(" RESTART: %s\n",
143 ival == (int) LDAP_OPT_ON ? "on" : "off");
145 if(ldap_get_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &ival) != LDAP_SUCCESS) {
146 fprintf(stderr, "%s: ldap_get_option(protocol version) failed\n", argv[0]);
149 printf(" PROTOCOL VERSION: %d\n", ival);
151 if(ldap_get_option(NULL, LDAP_OPT_HOST_NAME, &sval) != LDAP_SUCCESS) {
152 fprintf(stderr, "%s: ldap_get_option(host name) failed\n", argv[0]);
155 printf(" HOST NAME: %s\n", sval);