//cheap compile time test for USING() macro
void using_test()
{
    USING( System::Management::ManagementObject, p, gcnew System::Management::ManagementObject ) //explicitly IDisposable
    USING( SpencerHakim::CoreAudio::AudioSessionNotificationHook, h, gcnew SpencerHakim::CoreAudio::AudioSessionNotificationHook ) //implicitly IDisposable, thanks to C++/CLI destructor sugar
    //USING( System::String, s, gcnew System::String("") ) //fails, since it's not disposable
        (void)0;
}
示例#2
0
RSA *HavePublicKey(const char *username, const char *ipaddress, const char *digest)
{
    if (USING(HavePublicKey))
    {
        return original_HavePublicKey(username, ipaddress, digest);
    }
    return HavePublicKey_result;
}
示例#3
0
int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
{
    if (USING(EVP_PKEY_cmp))
    {
        return original_EVP_PKEY_cmp(a, b);
    }
    return EVP_PKEY_cmp_result;
}
示例#4
0
int EVP_PKEY_type(int type)
{
    if (USING(EVP_PKEY_type))
    {
        return original_EVP_PKEY_type(type);
    }
    return EVP_PKEY_type_result;
}
示例#5
0
int X509_verify(X509 *a, EVP_PKEY *r)
{
    if (USING(X509_verify))
    {
        return original_X509_verify(a, r);
    }
    return X509_verify_result;
}
示例#6
0
EVP_PKEY *X509_get_pubkey(X509 *cert)
{
    if (USING(X509_get_pubkey))
    {
        return original_X509_get_pubkey(cert);
    }
    return X509_get_pubkey_result;
}
示例#7
0
X509 *SSL_get_peer_certificate(const SSL *ssl)
{
    if (USING(SSL_get_peer_certificate))
    {
        return original_SSL_get_peer_certificate(ssl);
    }
    return SSL_get_peer_certificate_result;
}
示例#8
0
int SSL_read(SSL *ssl, void *buf, int num)
{
    if (USING(SSL_read))
        return original_SSL_read(ssl, buf, num);
    if (SSL_read_buffer)
    {
        char *temp = buf;
        int i = 0;
        for (i = 0; SSL_read_buffer[i] != '\0'; ++i)
            temp[i] = SSL_read_buffer[i];
        return i;
    }
    return (SSL_read_result > num) ? num : SSL_read_result;
}
示例#9
0
int SSL_get_shutdown(const SSL *ssl)
{
    if (USING(SSL_get_shutdown))
        return original_SSL_get_shutdown(ssl);
    return SSL_get_shutdown_result;
}
示例#10
0
/*
 * Mock'ed functions
 */
int SSL_write(SSL *ssl, const void *buf, int num)
{
    if (USING(SSL_write))
        return original_SSL_write(ssl, buf, num);
    return (SSL_write_result > num) ? num : SSL_write_result;
}