• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ BIO_set_retry_write函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中BIO_set_retry_write函数的典型用法代码示例。如果您正苦于以下问题:C++ BIO_set_retry_write函数的具体用法?C++ BIO_set_retry_write怎么用?C++ BIO_set_retry_write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了BIO_set_retry_write函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: tou_socket_write

static int tou_socket_write(BIO *b, const char *in, int inl)
	{
	int ret;
#ifdef DEBUG_TOU_BIO
	fprintf(stderr, "tou_socket_write(%p,%p,%d)\n",b,in,inl);
#endif
	
	clear_tou_socket_error(b->num);
	/* call tou library */
	ret=tou_write(b->num,in,inl);
	BIO_clear_retry_flags(b);
	if (ret <= 0)
		{
		if (BIO_tou_socket_should_retry(b->num,ret))
		{
			BIO_set_retry_write(b);
#ifdef DEBUG_TOU_BIO
			fprintf(stderr, "tou_socket_write() setting retry flag\n");
#endif
		}
		}
#ifdef DEBUG_TOU_BIO
	fprintf(stderr, "tou_socket_write() = %d\n", ret);
#endif
	return(ret);
	}
开发者ID:MrKID,项目名称:RetroShare,代码行数:26,代码来源:bss_tou.c


示例2: dgram_write

static int dgram_write(BIO *b, const char *in, int inl)
	{
	int ret;
	bio_dgram_data *data = (bio_dgram_data *)b->ptr;
	clear_socket_error();

    if ( data->connected )
        ret=writesocket(b->num,in,inl);
    else
#if defined(NETWARE_CLIB) && defined(NETWARE_BSDSOCK)
        ret=sendto(b->num, (char *)in, inl, 0, &data->peer, sizeof(data->peer));
#else
        ret=sendto(b->num, in, inl, 0, &data->peer, sizeof(data->peer));
#endif

	BIO_clear_retry_flags(b);
	if (ret <= 0)
		{
		if (BIO_sock_should_retry(ret))
			{
			BIO_set_retry_write(b);  
			data->_errno = get_last_socket_error();

#if 0 /* higher layers are responsible for querying MTU, if necessary */
			if ( data->_errno == EMSGSIZE)
				/* retrieve the new MTU */
				BIO_ctrl(b, BIO_CTRL_DGRAM_QUERY_MTU, 0, NULL);
#endif
			}
		}
	return(ret);
	}
开发者ID:8003178550,项目名称:dsploit,代码行数:32,代码来源:bss_dgram.c


示例3: tlso_bio_write

static int
tlso_bio_write( BIO *b, const char *buf, int len )
{
	struct tls_data		*p;
	int			ret;
	
	if ( buf == NULL || len <= 0 ) return 0;
	
	p = (struct tls_data *)b->ptr;

	if ( p == NULL || p->sbiod == NULL ) {
		return 0;
	}

	ret = LBER_SBIOD_WRITE_NEXT( p->sbiod, (char *)buf, len );

	BIO_clear_retry_flags( b );
	if ( ret < 0 ) {
		int err = sock_errno();
		if ( err == EAGAIN || err == EWOULDBLOCK ) {
			BIO_set_retry_write( b );
		}
	}

	return ret;
}
开发者ID:cptaffe,项目名称:openldap,代码行数:26,代码来源:tls_o.c


示例4: memory_write

static int memory_write(BIO *b, const char *in, int inl)
{
	int ret = -1;
	char strBuffer[MAX_UDP_PACKET_SIZE];
	BIO_memory_data* pData = (BIO_memory_data*)b->ptr;
	
	//
	strBuffer[0] = (char)(CW_PROTOCOL_VERSION << 4) | (char)(CW_PACKET_CRYPT);
	strBuffer[1] = strBuffer[2] = strBuffer[3] = 0;

	//
	memcpy(&strBuffer[4], in, inl);

	//
	errno = 0;
	ret = sendto(pData->sock, strBuffer, inl + 4, 0, (struct sockaddr*)&pData->sendAddress, sizeof(struct sockaddr_storage));

	//BIO_clear_retry_flags(b);
	if (ret <= 0)
	{
		if (errno == EINTR)
			BIO_set_retry_write(b);  
	}
	else
	{
		ret -= 4;
	}
	
	return ret;
}
开发者ID:kernel-digger,项目名称:openCAPWAP,代码行数:30,代码来源:CWOpenSSLBio.c


示例5: _mongoc_stream_tls_bio_write

static int
_mongoc_stream_tls_bio_write (BIO        *b,
                              const char *buf,
                              int         len)
{
   mongoc_stream_tls_t *tls;
   mongoc_iovec_t iov;
   int ret;

   BSON_ASSERT (b);
   BSON_ASSERT (buf);

   if (!(tls = b->ptr)) {
      return -1;
   }

   iov.iov_base = (void *)buf;
   iov.iov_len = len;

   errno = 0;
   ret = (int)mongoc_stream_writev (tls->base_stream, &iov, 1,
                                    tls->timeout_msec);
   BIO_clear_retry_flags (b);

   if ((ret < 0) && MONGOC_ERRNO_IS_AGAIN (errno)) {
      BIO_set_retry_write (b);
   }

   return ret;
}
开发者ID:jeromelebel,项目名称:mongo-c-driver,代码行数:30,代码来源:mongoc-stream-tls.c


示例6: ACE_ASYNCH_BIO_WRITE_NAME

int
ACE_ASYNCH_BIO_WRITE_NAME (BIO * pBIO, const char * buf, int len)
{
  BIO_clear_retry_flags (pBIO);

  ACE_SSL_Asynch_Stream * p_stream =
    static_cast<ACE_SSL_Asynch_Stream *> (pBIO->ptr);

  if (pBIO->init == 0 || p_stream == 0 || buf == 0 || len <= 0)
    return -1;

  BIO_clear_retry_flags (pBIO);

  int errval = 0;

  int retval =
    ACE_SSL_Asynch_Stream_Accessor::write (p_stream,
                                           buf,
                                           len,
                                           errval);

  if (retval >= 0)
    return retval;

  if (errval == EINPROGRESS)
    BIO_set_retry_write (pBIO);

  return -1;
}
开发者ID:CCJY,项目名称:ACE,代码行数:29,代码来源:SSL_Asynch_BIO.cpp


示例7: ssl_write

static int ssl_write(BIO *bio, const char *out, int outl) {
  SSL *ssl = bio->ptr;
  if (ssl == NULL) {
    return 0;
  }

  BIO_clear_retry_flags(bio);

  const int ret = SSL_write(ssl, out, outl);

  switch (SSL_get_error(ssl, ret)) {
    case SSL_ERROR_WANT_WRITE:
      BIO_set_retry_write(bio);
      break;

    case SSL_ERROR_WANT_READ:
      BIO_set_retry_read(bio);
      break;

    case SSL_ERROR_WANT_CONNECT:
      BIO_set_retry_special(bio);
      bio->retry_reason = BIO_RR_CONNECT;
      break;

    case SSL_ERROR_NONE:
    case SSL_ERROR_SYSCALL:
    case SSL_ERROR_SSL:
    default:
      break;
  }

  return ret;
}
开发者ID:alagoutte,项目名称:proto-quic,代码行数:33,代码来源:bio_ssl.c


示例8: dgram_write

static int
dgram_write(BIO *b, const char *in, int inl)
{
	int ret;
	bio_dgram_data *data = (bio_dgram_data *)b->ptr;
	errno = 0;

	if (data->connected)
		ret = write(b->num, in, inl);
	else {
		int peerlen = sizeof(data->peer);

		if (data->peer.sa.sa_family == AF_INET)
			peerlen = sizeof(data->peer.sa_in);
		else if (data->peer.sa.sa_family == AF_INET6)
			peerlen = sizeof(data->peer.sa_in6);
		ret = sendto(b->num, in, inl, 0, &data->peer.sa, peerlen);
	}

	BIO_clear_retry_flags(b);
	if (ret <= 0) {
		if (BIO_dgram_should_retry(ret)) {
			BIO_set_retry_write(b);

			data->_errno = errno;
			/*
			 * higher layers are responsible for querying MTU,
			 * if necessary
			 */
		}
	}
	return (ret);
}
开发者ID:randombit,项目名称:hacrypto,代码行数:33,代码来源:bss_dgram.c


示例9: bio_bufferevent_write

/* Called to write data info the BIO */
static int
bio_bufferevent_write(BIO *b, const char *in, int inlen)
{
	struct bufferevent *bufev = BIO_get_data(b);
	struct evbuffer *output;
	size_t outlen;

	BIO_clear_retry_flags(b);

	if (!BIO_get_data(b))
		return -1;

	output = bufferevent_get_output(bufev);
	outlen = evbuffer_get_length(output);

	/* Copy only as much data onto the output buffer as can fit under the
	 * high-water mark. */
	if (bufev->wm_write.high && bufev->wm_write.high <= (outlen+inlen)) {
		if (bufev->wm_write.high <= outlen) {
			/* If no data can fit, we'll need to retry later. */
			BIO_set_retry_write(b);
			return -1;
		}
		inlen = bufev->wm_write.high - outlen;
	}

	EVUTIL_ASSERT(inlen > 0);
	evbuffer_add(output, in, inlen);
	return inlen;
}
开发者ID:CTSRD-CHERI,项目名称:cheribsd,代码行数:31,代码来源:bufferevent_openssl.c


示例10: tls_bio_mbuf_write

/** write to a mbuf.
 * (internal openssl use via the tls_mbuf method)
 * @return bytes written on success (0<= ret <=src_len), -1 on error or buffer
 * full (in this case sets should_retry_write).
 */
static int tls_bio_mbuf_write(BIO* b, const char* src, int src_len)
{
	struct tls_bio_mbuf_data* d;
	struct tls_mbuf* wr;
	int ret;

	ret = 0;
#if OPENSSL_VERSION_NUMBER < 0x010100000L
	d = b->ptr;
#else
	d = BIO_get_data(b);
#endif
	BIO_clear_retry_flags(b);
	if (unlikely(d == 0 || d->wr->buf == 0)) {
		if (d == 0)
			BUG("tls_BIO_mbuf %p: write called with null b->ptr\n", b);
		else {
			/* this form of calling write with a null buffer is used
			   as a shortcut when no data is available =>
			   simulate EAGAIN/WANT_WRITE */
			TLS_BIO_DBG("write (%p, %p, %d) called with null buffer"
					" => simulating WANT_WRITE\n", b, src, src_len);
			BIO_set_retry_write(b);
		}
		return -1;
	}
	wr = d->wr;
	if (unlikely(wr->size == wr->used && src_len)) {
		/* mimic non-blocking socket behaviour */
		TLS_BIO_DBG("write (%p, %p, %d) called with full wr buffer (%d)"
					" => simulating WANT_WRITE\n", b, src, src_len, wr->used);
		BIO_set_retry_write(b);
		return -1;
	}
	ret = MIN_int(wr->size - wr->used, src_len);
	memcpy(wr->buf + wr->used, src, ret);
	wr->used += ret;
/*	if (unlikely(ret < src_len))
		BIO_set_retry_write();
*/
	TLS_BIO_DBG("write called (%p, %p, %d) => %d\n", b, src, src_len, ret);
	return ret;
}
开发者ID:albertollamaso,项目名称:kamailio,代码行数:48,代码来源:tls_bio.c


示例11: fd_write

static int fd_write(BIO *b, const char *in, int inl) {
  int ret = write(b->num, in, inl);
  BIO_clear_retry_flags(b);
  if (ret <= 0) {
    if (bio_fd_should_retry(ret)) {
      BIO_set_retry_write(b);
    }
  }

  return ret;
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:11,代码来源:fd.c


示例12: _goconn_bio_write

int _goconn_bio_write (BIO *bio, const char *buf, int len) {
  struct goconn_bio_write_return ret;
  ret = goconn_bio_write(bio, (char *) buf, len);

  BIO_clear_retry_flags(bio);
  if (ret.r0 == -1 && ret.r1 == EAGAIN) {
    BIO_set_retry_write(bio);
  }

  return ret.r0;
}
开发者ID:codemedic,项目名称:sslconn,代码行数:11,代码来源:conn.c


示例13: fd_write

static int fd_write(BIO *b, const char *in, int inl)
{
    int ret;
    clear_sys_error();
    ret = UP_write(b->num, in, inl);
    BIO_clear_retry_flags(b);
    if (ret <= 0) {
        if (BIO_fd_should_retry(ret))
            BIO_set_retry_write(b);
    }
    return (ret);
}
开发者ID:03050903,项目名称:godot,代码行数:12,代码来源:bss_fd.c


示例14: sock_write

static int sock_write(BIO *b, const char *in, int inl) {
  int ret;

  bio_clear_socket_error();
  ret = send(b->num, in, inl, 0);
  BIO_clear_retry_flags(b);
  if (ret <= 0) {
    if (bio_fd_should_retry(ret)) {
      BIO_set_retry_write(b);
    }
  }
  return ret;
}
开发者ID:xin3liang,项目名称:platform_external_chromium_org_third_party_boringssl_src,代码行数:13,代码来源:socket.c


示例15: sock_write

static int sock_write(BIO *b, const char *in, int inl)
{
    int ret;

    clear_socket_error();
    ret = writesocket(b->num, in, inl);
    BIO_clear_retry_flags(b);
    if (ret <= 0) {
        if (BIO_sock_should_retry(ret))
            BIO_set_retry_write(b);
    }
    return ret;
}
开发者ID:RTEMS,项目名称:rtems-libbsd,代码行数:13,代码来源:bss_sock.c


示例16: url_bio_bwrite

static int url_bio_bwrite(BIO *b, const char *buf, int len)
{
    URLContext *h = GET_BIO_DATA(b);
    int ret = ffurl_write(h, buf, len);
    if (ret >= 0)
        return ret;
    BIO_clear_retry_flags(b);
    if (ret == AVERROR(EAGAIN))
        BIO_set_retry_write(b);
    if (ret == AVERROR_EXIT)
        return 0;
    return -1;
}
开发者ID:Rodeo314,项目名称:tim-libav,代码行数:13,代码来源:tls_openssl.c


示例17: sock_write

static int sock_write(BIO *b, const char *in, int inl)
	{
	int ret;
	
	clear_socket_error();
	ret=ssl_sendmsg((struct socket*)b->num,in,inl);
	BIO_clear_retry_flags(b);
	if (ret <= 0)
		{
		if (BIO_sock_should_retry(ret))
			BIO_set_retry_write(b);
		}
	return(ret);
	}
开发者ID:millken,项目名称:zhuxianB30,代码行数:14,代码来源:bss_sock.c


示例18: bio_bufq_write

static int bio_bufq_write(BIO *h, const char *buf, int size)
{
  uint64_t n;
  ph_bufq_t *q = h->ptr;

  BIO_clear_retry_flags(h);
  if (ph_bufq_append(q, buf, size, &n) != PH_OK) {
    BIO_set_retry_write(h);
    errno = EAGAIN;
    return -1;
  }

  return (int)n;
}
开发者ID:DreamDuo,项目名称:libphenom,代码行数:14,代码来源:bio_bufq.c


示例19: nbiof_write

static int nbiof_write (BIO * b, const char *in, int inl)
{
    NBIO_TEST *nt;

    int ret = 0;

    int num;

    unsigned char n;

    if ((in == NULL) || (inl <= 0))
        return (0);
    if (b->next_bio == NULL)
        return (0);
    nt = (NBIO_TEST *) b->ptr;

    BIO_clear_retry_flags (b);

#if 1
    if (nt->lwn > 0)
    {
        num = nt->lwn;
        nt->lwn = 0;
    }
    else
    {
        RAND_pseudo_bytes (&n, 1);
        num = (n & 7);
    }

    if (inl > num)
        inl = num;

    if (num == 0)
    {
        ret = -1;
        BIO_set_retry_write (b);
    }
    else
#endif
    {
        ret = BIO_write (b->next_bio, in, inl);
        if (ret < 0)
        {
            BIO_copy_next_retry (b);
            nt->lwn = inl;
        }
    }
    return (ret);
}
开发者ID:274914765,项目名称:C,代码行数:50,代码来源:bf_nbio.c


示例20: my_sock_write

static int
my_sock_write(BIO *h, const char *buf, int size)
{
	int			res = 0;

	res = send(h->num, buf, size, 0);
	if (res <= 0)
	{
		if (errno == EINTR)
		{
			BIO_set_retry_write(h);
		}
	}

	return res;
}
开发者ID:denishpatel,项目名称:postgres,代码行数:16,代码来源:be-secure.c



注:本文中的BIO_set_retry_write函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BIO_should_retry函数代码示例发布时间:2022-05-30
下一篇:
C++ BIO_set_retry_read函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap