]> git.sur5r.net Git - openldap/blob - libraries/libldap/cancel.c
Sync with HEAD
[openldap] / libraries / libldap / cancel.c
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 1998-2003 The OpenLDAP Foundation.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted only as authorized by the OpenLDAP
9  * Public License.
10  *
11  * A copy of this license is available in the file LICENSE in the
12  * top-level directory of the distribution or, alternatively, at
13  * <http://www.OpenLDAP.org/license.html>.
14  */
15
16 /*
17  * LDAPv3 Cancel Operation Request
18  */
19
20 #include "portable.h"
21
22 #include <stdio.h>
23 #include <ac/stdlib.h>
24
25 #include <ac/socket.h>
26 #include <ac/string.h>
27 #include <ac/time.h>
28
29 #include "ldap-int.h"
30 #include "ldap_log.h"
31
32 #ifdef LDAP_EXOP_X_CANCEL
33
34 int
35 ldap_cancel(
36         LDAP            *ld,
37         int             cancelid,
38         LDAPControl     **sctrls,
39         LDAPControl     **cctrls,
40         int             *msgidp )
41 {
42         BerElement *cancelidber = NULL;
43         struct berval *cancelidvalp = NULL;
44         int rc;
45
46         cancelidber = ber_alloc_t( LBER_USE_DER );
47         ber_printf( cancelidber, "{i}", cancelid );
48         ber_flatten( cancelidber, &cancelidvalp );
49         rc = ldap_extended_operation( ld, LDAP_EXOP_X_CANCEL,
50                         cancelidvalp, sctrls, cctrls, msgidp );
51         ber_free( cancelidber, 1 );
52         return rc;
53 }
54
55 int
56 ldap_cancel_s(
57         LDAP            *ld,
58         int             cancelid,
59         LDAPControl     **sctrls,
60         LDAPControl     **cctrls )
61 {
62         BerElement *cancelidber = NULL;
63         struct berval *cancelidvalp = NULL;
64         int rc;
65
66         cancelidber = ber_alloc_t( LBER_USE_DER );
67         ber_printf( cancelidber, "{i}", cancelid );
68         ber_flatten( cancelidber, &cancelidvalp );
69         rc = ldap_extended_operation_s( ld, LDAP_EXOP_X_CANCEL,
70                         cancelidvalp, sctrls, cctrls, NULL, NULL );
71         ber_free( cancelidber, 1 );
72         return rc;
73 }
74
75 #endif /* LDAP_EXOP_X_CANCEL */