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

C++ channel_free函数代码示例

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

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



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

示例1: remmina_ssh_tunnel_close_all_channels

static void
remmina_ssh_tunnel_close_all_channels (RemminaSSHTunnel *tunnel)
{
	int i;

	for (i = 0; i < tunnel->num_channels; i++)
	{
		close (tunnel->sockets[i]);
		remmina_ssh_tunnel_buffer_free (tunnel->socketbuffers[i]);
		channel_close (tunnel->channels[i]);
		channel_free (tunnel->channels[i]);
	}

	g_free(tunnel->channels);
	tunnel->channels = NULL;
	g_free(tunnel->sockets);
	tunnel->sockets = NULL;
	g_free(tunnel->socketbuffers);
	tunnel->socketbuffers = NULL;

	tunnel->num_channels = 0;
	tunnel->max_channels = 0;

	if (tunnel->x11_channel)
	{
		channel_close (tunnel->x11_channel);
		channel_free (tunnel->x11_channel);
		tunnel->x11_channel = NULL;
	}
}
开发者ID:B0SB05,项目名称:Remmina,代码行数:30,代码来源:remmina_ssh.c


示例2: test_body

void
test_body (void)
{
    const gchar chunk[] = "This is a body text.";
    const gchar *packet;
    gsize packet_size;
    gsize packed_size;

    test_end_of_header();
    channel_free();

    reply_continue();

    cut_assert_true(milter_server_context_body(context, chunk, strlen(chunk)));
    pump_all_events();
    milter_test_assert_state(BODY);
    milter_test_assert_status(NOT_CHANGE);

    milter_command_encoder_encode_body(encoder, &packet, &packet_size,
                                       chunk, strlen(chunk), &packed_size);
    milter_test_assert_packet(channel, packet, packet_size);
    cut_assert_equal_uint(strlen(chunk), packed_size);

    cut_assert_equal_uint(0, n_message_processed);
}
开发者ID:michaelm260,项目名称:milter-manager,代码行数:25,代码来源:test-server-context-command.c


示例3: test_header

void
test_header (void)
{
    const gchar name[] = "X-HEADER-NAME";
    const gchar value[] = "MilterServerContext test";
    const gchar *packet;
    gsize packet_size;

    test_data();
    channel_free();

    reply_continue();

    cut_assert_true(milter_server_context_header(context, name, value));
    pump_all_events();
    milter_test_assert_state(HEADER);
    milter_test_assert_status(NOT_CHANGE);

    milter_command_encoder_encode_header(encoder,
                                         &packet, &packet_size,
                                         name, value);
    milter_test_assert_packet(channel, packet, packet_size);

    cut_assert_equal_uint(0, n_message_processed);
}
开发者ID:michaelm260,项目名称:milter-manager,代码行数:25,代码来源:test-server-context-command.c


示例4: test_ofp_table_stats_reply_create_null

void
test_ofp_table_stats_reply_create_null(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  struct channel *channel = channel_alloc_ip4addr("127.0.0.1", "1000", 0x01);
  struct pbuf_list *pbuf_list = NULL;
  struct ofp_header xid_header;

  ret = ofp_table_stats_reply_create(NULL, &pbuf_list, &tstats_list,
                                     &xid_header);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (channel)");

  ret = ofp_table_stats_reply_create(channel, NULL, &tstats_list,
                                     &xid_header);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (pbuf)");

  ret = ofp_table_stats_reply_create(channel, &pbuf_list, NULL, &xid_header);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (ofp_table_stats_list)");

  ret = ofp_table_stats_reply_create(channel, &pbuf_list, &tstats_list,
                                     NULL);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (xid_header)");

  channel_free(channel);
}
开发者ID:lagopus,项目名称:lagopus,代码行数:28,代码来源:ofp_table_handler_test.c


示例5: test_quit

void
test_quit (void)
{
    const gchar *packet;
    gsize packet_size;

    test_end_of_message_without_chunk();
    channel_free();

    reply_continue();

    cut_assert_true(milter_server_context_quit(context));
    pump_all_events();
    milter_test_assert_state(QUIT);
    milter_test_assert_status(NOT_CHANGE);

    milter_command_encoder_encode_quit(encoder, &packet, &packet_size);
    milter_test_assert_packet(channel, packet, packet_size);

    cut_assert_equal_uint(1, n_message_processed);
    milter_test_assert_result("[email protected]",
                              RECIPIENTS("[email protected]", NULL),
                              HEADERS("X-HEADER-NAME",
                                      "MilterServerContext test",
                                      NULL),
                              20,
                              STATE(END_OF_MESSAGE_REPLIED),
                              STATUS(NOT_CHANGE),
                              HEADERS(NULL),
                              HEADERS(NULL),
                              FALSE);
}
开发者ID:michaelm260,项目名称:milter-manager,代码行数:32,代码来源:test-server-context-command.c


示例6: test_ofp_queue_get_config_handle_null

void
test_ofp_queue_get_config_handle_null(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  struct channel *channel = channel_alloc_ip4addr("127.0.0.1", "1000", 0x01);
  struct pbuf *pbuf = pbuf_alloc(65535);
  struct ofp_header ofp_header;
  struct ofp_error error;

  ret = ofp_queue_get_config_request_handle(NULL, pbuf, &ofp_header, &error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (channel)");

  ret = ofp_queue_get_config_request_handle(channel, NULL, &ofp_header, &error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (pbuf)");

  ret = ofp_queue_get_config_request_handle(channel, pbuf, NULL, &error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (ofp_header)");

  ret = ofp_queue_get_config_request_handle(channel, pbuf, &ofp_header, NULL);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (ofp_error)");
  channel_free(channel);
  pbuf_free(pbuf);
}
开发者ID:lagopus,项目名称:lagopus,代码行数:26,代码来源:ofp_queue_config_handler_test.c


示例7: server_request_session

static Channel *
server_request_session(void)
{
	Channel *c;

	debug("input_session_request");
	packet_check_eom();

	if (no_more_sessions) {
		packet_disconnect("Possible attack: attempt to open a session "
		    "after additional sessions disabled");
	}

	/*
	 * A server session has no fd to read or write until a
	 * CHANNEL_REQUEST for a shell is made, so we set the type to
	 * SSH_CHANNEL_LARVAL.  Additionally, a callback for handling all
	 * CHANNEL_REQUEST messages is registered.
	 */
	c = channel_new("session", SSH_CHANNEL_LARVAL,
	    -1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT,
	    0, "server-session", 1);
	if (session_open(the_authctxt, c->self) != 1) {
		debug("session open failed, free channel %d", c->self);
		channel_free(c);
		return NULL;
	}
	channel_register_cleanup(c->self, session_close_by_channel, 0);
	return c;
}
开发者ID:bsloane1650,项目名称:Openssh-snooper,代码行数:30,代码来源:serverloop.c


示例8: test_ofp_barrier_reply_create_null

void
test_ofp_barrier_reply_create_null(void) {
  lagopus_result_t ret;
  struct barrier barrier;
  struct event_manager *em = event_manager_alloc();
  struct channel *channel =
    channel_alloc_ip4addr("127.0.0.1", "1000", em, 0x01);
  struct pbuf *pbuf;

  ret = ofp_barrier_reply_create(NULL, &barrier,
                                 &pbuf);
  TEST_ASSERT_EQUAL_MESSAGE(ret, LAGOPUS_RESULT_INVALID_ARGS,
                            "ofp_barrier_reply_create error.");

  ret = ofp_barrier_reply_create(channel, NULL,
                                 &pbuf);
  TEST_ASSERT_EQUAL_MESSAGE(ret, LAGOPUS_RESULT_INVALID_ARGS,
                            "ofp_barrier_reply_create error.");

  ret = ofp_barrier_reply_create(channel, &barrier,
                                 NULL);
  TEST_ASSERT_EQUAL_MESSAGE(ret, LAGOPUS_RESULT_INVALID_ARGS,
                            "ofp_barrier_reply_create error.");
  /* after. */
  channel_free(channel);
  event_manager_free(em);
}
开发者ID:JackieXie168,项目名称:lagopus,代码行数:27,代码来源:ofp_barrier_handler_test.c


示例9: test_ofp_role_request_handle_with_null_agument

void
test_ofp_role_request_handle_with_null_agument(void) {
  /* Case of invlid argument.*/
  struct channel *channel =
    channel_alloc_ip4addr("127.0.0.1", "1000", 0x01);
  struct pbuf pbuf;
  struct ofp_header xid_header;
  lagopus_result_t ret;
  struct ofp_error error;

  /* struct ofp_error error; */
  ret = ofp_role_request_handle(NULL, &pbuf, &xid_header, &error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL should be treated as invalid arguments");
  ret = ofp_role_request_handle(channel, NULL, &xid_header, &error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL should be treated as invalid arguments");
  ret = ofp_role_request_handle(channel, &pbuf, NULL, &error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL should be treated as invalid arguments");
  ret = ofp_role_request_handle(channel, &pbuf, &xid_header, NULL);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL should be treated as invalid arguments");

  channel_free(channel);
}
开发者ID:lagopus,项目名称:lagopus,代码行数:26,代码来源:ofp_role_request_handler_test.c


示例10: test_ofp_get_async_request_handle_invalid_argument

void
test_ofp_get_async_request_handle_invalid_argument(void) {
  /* Case of invalid argument.*/
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  struct event_manager *em = event_manager_alloc();
  struct channel *channel = channel_alloc_ip4addr("127.0.0.1", "1000",
                            em, 0x01);
  struct pbuf *pbuf = pbuf_alloc(65535);
  struct ofp_header xid_header;
  struct ofp_error ignored_error = {0, 0, {NULL}};

  ret = ofp_get_async_request_handle(NULL, pbuf, &xid_header, &ignored_error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL checking is requred.");

  ret = ofp_get_async_request_handle(channel, NULL, &xid_header,
                                     &ignored_error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL checking is requred.");

  ret = ofp_get_async_request_handle(channel, pbuf, NULL, &ignored_error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL checking is requred.");

  ret = ofp_get_async_request_handle(channel, pbuf, &xid_header, NULL);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL checking is requred.");

  channel_free(channel);
  pbuf_free(pbuf);
  event_manager_free(em);
}
开发者ID:AkiraSuu,项目名称:lagopus,代码行数:32,代码来源:ofp_get_async_handler_test.c


示例11: server_request_session

static Channel *
server_request_session(struct ssh *ssh)
{
	Channel *c;
	int r;

	debug("input_session_request");
	if ((r = sshpkt_get_end(ssh)) != 0)
		fatal("%s: %s", __func__, ssh_err(r));

	if (no_more_sessions) {
		ssh_packet_disconnect(ssh,
		    "Possible attack: attempt to open a session "
		    "after additional sessions disabled");
	}

	/*
	 * A server session has no fd to read or write until a
	 * CHANNEL_REQUEST for a shell is made, so we set the type to
	 * SSH_CHANNEL_LARVAL.  Additionally, a callback for handling all
	 * CHANNEL_REQUEST messages is registered.
	 */
	c = channel_new(ssh, "session", SSH_CHANNEL_LARVAL,
	    -1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT,
	    0, "server-session", 1);
	if (session_open(ssh, c->self) != 1) {
		debug("session open failed, free channel %d", c->self);
		channel_free(c);
		return NULL;
	}
	channel_register_cleanup(c->self, session_close_by_channel, 0);
	return c;
}
开发者ID:cafeinecake,项目名称:libopenssh,代码行数:33,代码来源:serverloop.c


示例12: test_ofp_group_mod_handle_wrap_null

void
test_ofp_group_mod_handle_wrap_null(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  struct event_manager *em = event_manager_alloc();
  struct channel *channel = channel_alloc_ip4addr("127.0.0.1", "1000",
                            em, 0x01);
  struct pbuf *pbuf = pbuf_alloc(65535);
  struct ofp_header xid_header;
  struct ofp_error error;

  ret = ofp_group_mod_handle(NULL, pbuf, &xid_header, &error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (channel)");

  ret = ofp_group_mod_handle(channel, NULL, &xid_header, &error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (pbuf)");

  ret = ofp_group_mod_handle(channel, pbuf, NULL, &error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (xid_header)");

  ret = ofp_group_mod_handle(channel, pbuf, &xid_header, NULL);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (xid_header)");

  channel_free(channel);
  pbuf_free(pbuf);
  event_manager_free(em);
}
开发者ID:AkiraSuu,项目名称:lagopus,代码行数:30,代码来源:ofp_group_mod_handler_test.c


示例13: test_ofp_role_reply_create_with_null_agument

void
test_ofp_role_reply_create_with_null_agument(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  struct channel *channel =
    channel_alloc_ip4addr("127.0.0.1", "1000", 0x01);
  struct pbuf *pbuf;
  struct ofp_header xid_header;
  struct ofp_role_request role_request;
  role_request.role = OFPCR_ROLE_SLAVE;
  role_request.generation_id = 0x01;

  /* TODO add error as a 4th argument */
  /* struct ofp_error error; */
  ret = ofp_role_reply_create(NULL, &pbuf, &xid_header, &role_request);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL should be treated as invalid arguments");
  ret = ofp_role_reply_create(channel, NULL, &xid_header, &role_request);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL should be treated as invalid arguments");
  ret = ofp_role_reply_create(channel, &pbuf, NULL, &role_request);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL should be treated as invalid arguments");

  channel_free(channel);
}
开发者ID:lagopus,项目名称:lagopus,代码行数:25,代码来源:ofp_role_request_handler_test.c


示例14: test_ofp_queue_get_config_reply_create_null

void
test_ofp_queue_get_config_reply_create_null(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  struct channel *channel = channel_alloc_ip4addr("127.0.0.1", "1000", 0x01);
  struct pbuf *pbuf = pbuf_alloc(65535);
  static struct packet_queue_list packet_queue_list;
  struct ofp_header ofp_header;

  ret = ofp_queue_get_config_reply_create(NULL, &pbuf, 0,
                                          &packet_queue_list,
                                          &ofp_header);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (channel)");

  ret = ofp_queue_get_config_reply_create(channel, NULL, 0,
                                          &packet_queue_list,
                                          &ofp_header);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (pbuf)");

  ret = ofp_queue_get_config_reply_create(channel, &pbuf, 0,
                                          NULL, &ofp_header);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (packet_queue_list)");

  ret = ofp_queue_get_config_reply_create(channel, &pbuf, 0,
                                          &packet_queue_list,
                                          NULL);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "NULL-check error. (ofp_header)");

  channel_free(channel);
  pbuf_free(pbuf);
}
开发者ID:lagopus,项目名称:lagopus,代码行数:34,代码来源:ofp_queue_config_handler_test.c


示例15: test_ofp_queue_stats_request_handle_null

void
test_ofp_queue_stats_request_handle_null(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  struct pbuf *pbuf = pbuf_alloc(65535);
  struct ofp_header xid_header;
  struct ofp_error error;
  struct channel *channel = channel_alloc_ip4addr("127.0.0.1", "1000", 0x01);

  ret = ofp_queue_stats_request_handle(NULL, pbuf, &xid_header, &error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "ofp_queue_stats_request_handle error.");

  ret = ofp_queue_stats_request_handle(channel, NULL, &xid_header, &error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "ofp_queue_stats_request_handle error.");

  ret = ofp_queue_stats_request_handle(channel, pbuf, NULL, &error);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "ofp_queue_stats_request_handle error.");

  ret = ofp_queue_stats_request_handle(channel, pbuf, &xid_header, NULL);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "ofp_queue_stats_request_handle error.");

  /* after. */
  channel_free(channel);
  pbuf_free(pbuf);
}
开发者ID:tidatida,项目名称:lagopus,代码行数:28,代码来源:ofp_queue_handler_test.c


示例16: test_abort_and_quit

void
test_abort_and_quit (void)
{
    const gchar *packet;
    gsize packet_size;

    test_envelope_recipient();
    channel_free();

    cut_assert_true(milter_server_context_abort(context));
    pump_all_events();
    milter_test_assert_state(ABORT);
    milter_test_assert_status(ABORT);

    cut_assert_true(milter_server_context_quit(context));
    pump_all_events();
    milter_test_assert_state(QUIT);
    milter_test_assert_status(ABORT);

    milter_command_encoder_encode_abort(encoder, &packet, &packet_size);
    packet_string = g_string_new_len(packet, packet_size);

    milter_command_encoder_encode_quit(encoder, &packet, &packet_size);
    g_string_append_len(packet_string, packet, packet_size);

    milter_test_assert_packet(channel, packet_string->str, packet_string->len);
}
开发者ID:michaelm260,项目名称:milter-manager,代码行数:27,代码来源:test-server-context-command.c


示例17: ssh_scp_close

int ssh_scp_close(ssh_scp scp){
  char buffer[128];
  int err;
  if(scp->channel != NULL){
    if(channel_send_eof(scp->channel) == SSH_ERROR){
      scp->state=SSH_SCP_ERROR;
      return SSH_ERROR;
    }
    /* avoid situations where data are buffered and
     * not yet stored on disk. This can happen if the close is sent
     * before we got the EOF back
     */
    while(!channel_is_eof(scp->channel)){
      err=channel_read(scp->channel,buffer,sizeof(buffer),0);
      if(err==SSH_ERROR)
        break;
    }
    if(channel_close(scp->channel) == SSH_ERROR){
      scp->state=SSH_SCP_ERROR;
      return SSH_ERROR;
    }
    channel_free(scp->channel);
    scp->channel=NULL;
  }
  scp->state=SSH_SCP_NEW;
  return SSH_OK;
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:27,代码来源:scp.c


示例18: eventloop_socket_remove

/** Remove channels from monitoring of the EventLoop.
 *
 * The EventLoop calls this function on its own when sockets have been released
 * using eventloop_socket_release(). You probably want to use that one instead.
 *
 * \param source SockEvtSource to remove and free
 * \see eventloop_socket_release, channel_free
 */
void eventloop_socket_remove(SockEvtSource* source)
{
  Channel* ch = (Channel*)source;

  eventloop_socket_activate(source, 0);

  /* Update the linked list */
  if (self.channels == ch) {
    self.channels = ch->next;

  } else {
    Channel* prev = self.channels;
    Channel* p = prev->next;

    while (p != NULL) {
      if (p == ch) {
        prev->next = ch->next;
        p = NULL; /* We're done */
      } else {
        prev = p;
        p = p->next;
      }
    }
  }

  channel_free(ch);
}
开发者ID:alco90,项目名称:soml,代码行数:35,代码来源:eventloop.c


示例19: test_ofp_experimenter_reply_create_null

void
test_ofp_experimenter_reply_create_null(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  struct pbuf *pbuf = pbuf_alloc(65535);
  struct ofp_header xid_header;
  struct event_manager *em = event_manager_alloc();
  struct channel *channel = channel_alloc_ip4addr("127.0.0.1", "1000",
                            em, 0x01);
  struct ofp_experimenter_header exper_req;

  ret = ofp_experimenter_reply_create(NULL, &pbuf, &xid_header, &exper_req);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "ofp_experimenter_reply_create error.");

  ret = ofp_experimenter_reply_create(channel, NULL, &xid_header, &exper_req);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "ofp_experimenter_reply_create error.");

  ret = ofp_experimenter_reply_create(channel, &pbuf, NULL, &exper_req);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "ofp_experimenter_reply_create error.");

  ret = ofp_experimenter_reply_create(channel, &pbuf, &xid_header, NULL);
  TEST_ASSERT_EQUAL_MESSAGE(LAGOPUS_RESULT_INVALID_ARGS, ret,
                            "ofp_experimenter_reply_create error.");

  /* after. */
  channel_free(channel);
  event_manager_free(em);
  pbuf_free(pbuf);
}
开发者ID:AkiraSuu,项目名称:lagopus,代码行数:31,代码来源:ofp_experimenter_handler_test.c


示例20: test_cmux_destroy_cell_queue

/** Test destroy cell queue with no interference from other queues. */
static void
test_cmux_destroy_cell_queue(void *arg)
{
  circuitmux_t *cmux = NULL;
  channel_t *ch = NULL;
  circuit_t *circ = NULL;
  cell_queue_t *cq = NULL;
  packed_cell_t *pc = NULL;
  tor_libevent_cfg cfg;

  memset(&cfg, 0, sizeof(cfg));

  tor_libevent_initialize(&cfg);
  scheduler_init();

#ifdef ENABLE_MEMPOOLS
  init_cell_pool();
#endif /* ENABLE_MEMPOOLS */
  (void) arg;

  cmux = circuitmux_alloc();
  tt_assert(cmux);
  ch = new_fake_channel();
  ch->has_queued_writes = has_queued_writes;
  ch->wide_circ_ids = 1;

  circ = circuitmux_get_first_active_circuit(cmux, &cq);
  tt_assert(!circ);
  tt_assert(!cq);

  circuitmux_append_destroy_cell(ch, cmux, 100, 10);
  circuitmux_append_destroy_cell(ch, cmux, 190, 6);
  circuitmux_append_destroy_cell(ch, cmux, 30, 1);

  tt_int_op(circuitmux_num_cells(cmux), OP_EQ, 3);

  circ = circuitmux_get_first_active_circuit(cmux, &cq);
  tt_assert(!circ);
  tt_assert(cq);

  tt_int_op(cq->n, OP_EQ, 3);

  pc = cell_queue_pop(cq);
  tt_assert(pc);
  tt_mem_op(pc->body, OP_EQ, "\x00\x00\x00\x64\x04\x0a\x00\x00\x00", 9);
  packed_cell_free(pc);
  pc = NULL;

  tt_int_op(circuitmux_num_cells(cmux), OP_EQ, 2);

 done:
  circuitmux_free(cmux);
  channel_free(ch);
  packed_cell_free(pc);

#ifdef ENABLE_MEMPOOLS
  free_cell_pool();
#endif /* ENABLE_MEMPOOLS */
}
开发者ID:uarka,项目名称:tor,代码行数:60,代码来源:test_circuitmux.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ channel_new函数代码示例发布时间:2022-05-30
下一篇:
C++ channel_find函数代码示例发布时间: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