當前位置: 首頁>>代碼示例>>C++>>正文


C++ BIO_set_init函數代碼示例

本文整理匯總了C++中BIO_set_init函數的典型用法代碼示例。如果您正苦於以下問題:C++ BIO_set_init函數的具體用法?C++ BIO_set_init怎麽用?C++ BIO_set_init使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了BIO_set_init函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: bio_zlib_new

static int bio_zlib_new(BIO *bi)
{
    BIO_ZLIB_CTX *ctx;
# ifdef ZLIB_SHARED
    (void)COMP_zlib();
    if (!zlib_loaded) {
        COMPerr(COMP_F_BIO_ZLIB_NEW, COMP_R_ZLIB_NOT_SUPPORTED);
        return 0;
    }
# endif
    ctx = OPENSSL_zalloc(sizeof(*ctx));
    if (ctx == NULL) {
        COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE);
        return 0;
    }
    ctx->ibufsize = ZLIB_DEFAULT_BUFSIZE;
    ctx->obufsize = ZLIB_DEFAULT_BUFSIZE;
    ctx->zin.zalloc = Z_NULL;
    ctx->zin.zfree = Z_NULL;
    ctx->zout.zalloc = Z_NULL;
    ctx->zout.zfree = Z_NULL;
    ctx->comp_level = Z_DEFAULT_COMPRESSION;
    BIO_set_init(bi, 1);
    BIO_set_data(bi, ctx);

    return 1;
}
開發者ID:qloong,項目名稱:openssl,代碼行數:27,代碼來源:c_zlib.c

示例2: bio_create

static int bio_create(BIO *b)
{
	BIO_set_init(b, 1);
	BIO_set_data(b, NULL);

	return 1;
}
開發者ID:YueLinHo,項目名稱:libgit2,代碼行數:7,代碼來源:openssl_stream.c

示例3: tls_bio_mbuf_new

/** create a new BIO.
 * (internal openssl use via the tls_mbuf method)
 * @return 1 on success, 0 on error.
 */
static int tls_bio_mbuf_new(BIO* b)
{
	struct tls_bio_mbuf_data* d;

	TLS_BIO_DBG("tls_bio_mbuf_new called (%p)\n", b);
#if OPENSSL_VERSION_NUMBER < 0x010100000L
	b->init = 0; /* not initialized yet */
	b->num = 0;
	b->ptr = 0;
	b->flags = 0;
	d = OPENSSL_malloc(sizeof(*d));
	if (unlikely(d == 0))
		return 0;
	d->rd = 0;
	d->wr = 0;
	b->ptr = d;
#else
	BIO_set_init(b, 0);
	BIO_set_data(b, NULL);
	d = OPENSSL_zalloc(sizeof(*d));
	if (unlikely(d == 0))
		return 0;
	BIO_set_data(b, d);
#endif
	return 1;
}
開發者ID:albertollamaso,項目名稱:kamailio,代碼行數:30,代碼來源:tls_bio.c

示例4: BIO_set_cipher

int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k,
                   const unsigned char *i, int e)
{
    BIO_ENC_CTX *ctx;
    long (*callback) (struct bio_st *, int, const char *, int, long, long);

    ctx = BIO_get_data(b);
    if (ctx == NULL)
        return 0;

    callback = BIO_get_callback(b);

    if ((callback != NULL) &&
            (callback(b, BIO_CB_CTRL, (const char *)c, BIO_CTRL_SET, e,
                      0L) <= 0))
        return 0;

    BIO_set_init(b, 1);

    if (!EVP_CipherInit_ex(ctx->cipher, c, NULL, k, i, e))
        return 0;

    if (callback != NULL)
        return callback(b, BIO_CB_CTRL, (const char *)c, BIO_CTRL_SET, e, 1L);
    return 1;
}
開發者ID:Muffo,項目名稱:openssl,代碼行數:26,代碼來源:bio_enc.c

示例5: tlso_bio_create

static int
tlso_bio_create( BIO *b ) {
	BIO_set_init( b, 1 );
	BIO_set_data( b, NULL );
	BIO_clear_flags( b, ~0 );
	return 1;
}
開發者ID:osstech-jp,項目名稱:openldap,代碼行數:7,代碼來源:tls_o.c

示例6: BIO_new

static BIO *dill_tls_new_cbio(void *mem) {
    BIO *bio = BIO_new(dill_tls_cbio);
    if(dill_slow(!bio)) {errno = EFAULT; return NULL;}
    BIO_set_data(bio, mem);
    BIO_set_init(bio, 1);
    return bio;
}
開發者ID:jimjag,項目名稱:libdill,代碼行數:7,代碼來源:tls.c

示例7: bio_bufferevent_new

/* Called to initialize a new BIO */
static int
bio_bufferevent_new(BIO *b)
{
	BIO_set_init(b, 0);
	BIO_set_data(b, NULL); /* We'll be putting the bufferevent in this field.*/
	return 1;
}
開發者ID:CTSRD-CHERI,項目名稱:cheribsd,代碼行數:8,代碼來源:bufferevent_openssl.c

示例8: transport_bio_simple_uninit

static int transport_bio_simple_uninit(BIO* bio)
{
	WINPR_BIO_SIMPLE_SOCKET* ptr = (WINPR_BIO_SIMPLE_SOCKET*) BIO_get_data(bio);

	if (BIO_get_shutdown(bio))
	{
		if (BIO_get_init(bio))
		{
			_shutdown(ptr->socket, SD_BOTH);
			closesocket(ptr->socket);
			ptr->socket = 0;
		}
	}

	if (ptr->hEvent)
	{
		CloseHandle(ptr->hEvent);
		ptr->hEvent = NULL;
	}

	BIO_set_init(bio, 0);
	BIO_set_flags(bio, 0);

	return 1;
}
開發者ID:kdienes,項目名稱:FreeRDP,代碼行數:25,代碼來源:tcp.c

示例9: bio_rdp_tls_free

static int bio_rdp_tls_free(BIO* bio)
{
	BIO_RDP_TLS* tls;

	if (!bio)
		return 0;

	tls = (BIO_RDP_TLS*) BIO_get_data(bio);

	if (!tls)
		return 0;

	if (BIO_get_shutdown(bio))
	{
		if (BIO_get_init(bio) && tls->ssl)
		{
			SSL_shutdown(tls->ssl);
			SSL_free(tls->ssl);
		}
		BIO_set_init(bio, 0);
		BIO_set_flags(bio, 0);
	}

	DeleteCriticalSection(&tls->lock);
	free(tls);
	return 1;
}
開發者ID:dcatonR1,項目名稱:FreeRDP,代碼行數:27,代碼來源:tls.c

示例10: tap_free

static int tap_free(BIO *b)
{
    if (b == NULL)
        return 0;
    BIO_set_data(b, NULL);
    BIO_set_init(b, 0);
    return 1;
}
開發者ID:IIJ-NetBSD,項目名稱:netbsd-src,代碼行數:8,代碼來源:tap_bio.c

示例11: mempacket_test_free

static int mempacket_test_free(BIO *bio)
{
    MEMPACKET_TEST_CTX *ctx = BIO_get_data(bio);

    sk_MEMPACKET_pop_free(ctx->pkts, mempacket_free);
    OPENSSL_free(ctx);
    BIO_set_data(bio, NULL);
    BIO_set_init(bio, 0);
    return 1;
}
開發者ID:danielctull-forks,項目名稱:openssl,代碼行數:10,代碼來源:ssltestlib.c

示例12: md_free

static int md_free(BIO *a)
{
    if (a == NULL)
        return 0;
    EVP_MD_CTX_free(BIO_get_data(a));
    BIO_set_data(a, NULL);
    BIO_set_init(a, 0);

    return 1;
}
開發者ID:Ana06,項目名稱:openssl,代碼行數:10,代碼來源:bio_md.c

示例13: bio_method_new

static int
bio_method_new (BIO * bio)
{
  GST_LOG_OBJECT (NULL, "BIO: new");

  BIO_set_shutdown (bio, 0);
  BIO_set_init (bio, 1);

  return 1;
}
開發者ID:MaZderMind,項目名稱:gst-plugins-bad,代碼行數:10,代碼來源:gstdtlsconnection.c

示例14: tlso_bio_destroy

static int
tlso_bio_destroy( BIO *b )
{
	if ( b == NULL ) return 0;

	BIO_set_data( b, NULL );		/* sb_tls_remove() will free it */
	BIO_set_init( b, 0 );
	BIO_clear_flags( b, ~0 );
	return 1;
}
開發者ID:osstech-jp,項目名稱:openldap,代碼行數:10,代碼來源:tls_o.c

示例15: mongoc_stream_tls_openssl_bio_create

int
mongoc_stream_tls_openssl_bio_create (BIO *b)
{
   BSON_ASSERT (b);

   BIO_set_init (b, 1);
   BIO_set_data (b, NULL);
   BIO_set_flags (b, 0);

   return 1;
}
開發者ID:mschoenlaub,項目名稱:mongo-c-driver,代碼行數:11,代碼來源:mongoc-stream-tls-openssl-bio.c


注:本文中的BIO_set_init函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。