Back to index

openldap  2.4.31
cancel.c
Go to the documentation of this file.
00001 /* $OpenLDAP$ */
00002 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00003  *
00004  * Copyright 1998-2012 The OpenLDAP Foundation.
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted only as authorized by the OpenLDAP
00009  * Public License.
00010  *
00011  * A copy of this license is available in the file LICENSE in the
00012  * top-level directory of the distribution or, alternatively, at
00013  * <http://www.OpenLDAP.org/license.html>.
00014  */
00015 /* ACKNOWLEDGEMENTS:
00016  * This program was originally developed by Kurt D. Zeilenga for inclusion
00017  * in OpenLDAP Software.
00018  */
00019 
00020 /*
00021  * LDAPv3 Cancel Operation Request
00022  */
00023 
00024 #include "portable.h"
00025 
00026 #include <stdio.h>
00027 #include <ac/stdlib.h>
00028 
00029 #include <ac/socket.h>
00030 #include <ac/string.h>
00031 #include <ac/time.h>
00032 
00033 #include "ldap-int.h"
00034 #include "ldap_log.h"
00035 
00036 int
00037 ldap_cancel(
00038        LDAP          *ld,
00039        int           cancelid,
00040        LDAPControl   **sctrls,
00041        LDAPControl   **cctrls,
00042        int           *msgidp )
00043 {
00044        BerElement *cancelidber = NULL;
00045        struct berval *cancelidvalp = NULL;
00046        int rc;
00047 
00048        cancelidber = ber_alloc_t( LBER_USE_DER );
00049        ber_printf( cancelidber, "{i}", cancelid );
00050        ber_flatten( cancelidber, &cancelidvalp );
00051        rc = ldap_extended_operation( ld, LDAP_EXOP_CANCEL,
00052               cancelidvalp, sctrls, cctrls, msgidp );
00053        ber_free( cancelidber, 1 );
00054        return rc;
00055 }
00056 
00057 int
00058 ldap_cancel_s(
00059        LDAP          *ld,
00060        int           cancelid,
00061        LDAPControl   **sctrls,
00062        LDAPControl   **cctrls )
00063 {
00064        BerElement *cancelidber = NULL;
00065        struct berval *cancelidvalp = NULL;
00066        int rc;
00067 
00068        cancelidber = ber_alloc_t( LBER_USE_DER );
00069        ber_printf( cancelidber, "{i}", cancelid );
00070        ber_flatten( cancelidber, &cancelidvalp );
00071        rc = ldap_extended_operation_s( ld, LDAP_EXOP_CANCEL,
00072               cancelidvalp, sctrls, cctrls, NULL, NULL );
00073        ber_free( cancelidber, 1 );
00074        return rc;
00075 }
00076