当前位置: 首页>>代码示例>>C++>>正文


C++ channel_free函数代码示例

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


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


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