亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? nettest_libtecla.c

?? BCAST Implementation for NS2
?? C
字號:
/* -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*- *//* * Copyright (c) 2001-2003 International Computer Science Institute * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software") * to deal in the Software without restriction, subject to the conditions * listed in the XORP LICENSE file. These conditions include: you must * preserve this copyright notice, and you cannot mention the copyright * holders in advertising related to the Software without their permission. * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This * notice is a summary of the XORP LICENSE file; the license in that file is * legally binding. *//* * Portions of this software have one or more of the following copyrights, and * are subject to the license below. The relevant source files are clearly * marked; they refer to this file using the phrase ``the XORP LICENSE file''. * * Copyright (c) 2001-2003 International Computer Science Institute *  * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: *  * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. *  * The names and trademarks of copyright holders may not be used in * advertising or publicity pertaining to the software without specific * prior permission. Title to copyright in this software and any associated * documentation will at all times remain with the copyright holders. *  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *//* * Sample CLI (Command-Line Interface) implementation. * * Author: Pavlin Radoslavov (pavlin@icsi.berkeley.edu) * Date: Wed Dec 12 00:11:34 PST 2001 * * XXX: note that this example is very simplified: * it doesn't handle more than one connection, the error checks are * not adequate, etc. *//* * To complile, you need a modified version of libtecla that supports * network connection. If the directory to that library is ``./libtecla/'', * then: * gcc -g nettest_libtecla.c -L./libtecla -ltecla -ltermcap -o nettest_libtecla * * Usage: *  1. Start this program: ./nettest_libtecla *  2. From a different window you can telnet to this process on port 12000: *     telnet localhost 12000 */#include <stdlib.h>#include <stdio.h>#include <sys/types.h>#include <sys/time.h>#include <unistd.h>#include <sys/socket.h>#include <arpa/telnet.h>#include <netinet/in.h>#include "libtecla/libtecla.h"/* * Exported variables *//* * Local constants definitions */#define CLIENT_TERMINAL 1#define CLI_WELCOME "Welcome!"#define CLI_PROMPT  "CLI> "/* * Local structures, typedefs and macros *//* * Local variables */static int _serv_socket = -1;static unsigned short _serv_port = 0;	/* XXX: not defined yet */static FILE *_fd_file_read = NULL;static FILE *_fd_file_write = NULL;static int _client_type = CLIENT_TERMINAL;static GetLine *_gl = NULL;static int _telnet_iac = 0;static int _telnet_sb = 0;static int _window_width = 0;static int _window_height = 0;static int _telnet_sb_buffer_size = 0;static char _telnet_sb_buffer[1024];static int _telnet_dont = 0;static int _telnet_do = 0;static int _telnet_wont = 0;static int _telnet_will = 0;static char _command_buffer[1024];static int _command_buffer_size = 0;static int _buff_curpos = 0;/* * Local functions prototypes */void cli_setup();void start_connection(int fd);void client_read(int fd);int command_line_character(const char *line, int word_end, uint8_t val);intmain(int argc, char *argv[]){    struct sockaddr_in sin_addr;    struct sockaddr_in cli_addr;    int addrlen;    fd_set read_fds, write_fds;    int sock = -1;    int max_sock;    int reuse = 1;        _serv_socket = socket(AF_INET, SOCK_STREAM, 0);    if (setsockopt(_serv_socket, SOL_SOCKET, SO_REUSEADDR,		   (void *)&reuse, sizeof(reuse)) < 0) {	perror("setsockopt(SO_REUSEADDR)");	exit (1);    }    /* TODO: comment-out sin_len setup if the OS doesn't have it */    memset(&sin_addr, 0, sizeof(sin_addr));    sin_addr.sin_len = sizeof(sin_addr);    sin_addr.sin_family = AF_INET;    sin_addr.sin_port = htons(12000);		/* XXX: fixed port 12000 */    sin_addr.sin_addr.s_addr = INADDR_ANY;    if (bind(_serv_socket, (struct sockaddr *)&sin_addr, sizeof(sin_addr)) < 0) {	perror("Error binding");	exit (1);    }    if (listen(_serv_socket, 5) < 0) {	perror("Error listen");	exit (1);    }    cli_setup();        for ( ;; ) {	struct timeval my_timeval;		max_sock = _serv_socket;	FD_ZERO(&read_fds);	FD_ZERO(&write_fds);	FD_SET(_serv_socket, &read_fds);	/* FD_SET(_serv_socket, &write_fds); */	if (sock >= 0) {	    FD_SET(sock, &read_fds);	    /* FD_SET(sock, &write_fds); */	    if (max_sock < sock)		max_sock = sock;	}	max_sock++;		my_timeval.tv_sec = 1;	my_timeval.tv_usec = 0;	select(max_sock, &read_fds, &write_fds, NULL, &my_timeval);		if (FD_ISSET(_serv_socket, &read_fds)) {	    memset(&cli_addr, 0, sizeof(cli_addr));	    cli_addr.sin_len = sizeof(cli_addr);	    cli_addr.sin_family = AF_INET;	    sock = accept(_serv_socket, (struct sockaddr *)&cli_addr,			  &addrlen);	    if (sock < 0) {		perror("Error accepting connection");		exit (1);	    }	    start_connection(sock);	    continue;	}	if ((sock >= 0) && FD_ISSET(sock, &read_fds)) {	    client_read(sock);	}	printf("Tick...\n");    }}voidcli_setup(){    _fd_file_read = NULL;    _fd_file_write = NULL;    _client_type = CLIENT_TERMINAL;	/* XXX: default is terminal */        _gl = NULL;        _telnet_iac = 0;    _telnet_sb = 0;    /* TODO: those should be read in the beginning */    _window_width = 80;    _window_height = 25;}const char *newline(){    if (_client_type == CLIENT_TERMINAL)	return ("\r\n");        return ("\n");}voidstart_connection(int fd){    char cli_welcome[] = CLI_WELCOME;    char cli_prompt[] = CLI_PROMPT;    char buf[128];        /* Setup the telnet options */    {	char will_echo_cmd[] = { IAC, WILL, TELOPT_ECHO, '\0' };	char will_sga_cmd[]  = { IAC, WILL, TELOPT_SGA, '\0'  };	char dont_linemode_cmd[] = { IAC, DONT, TELOPT_LINEMODE, '\0' };	char do_window_size_cmd[] = { IAC, DO, TELOPT_NAWS, '\0' };	char do_transmit_binary_cmd[] = { IAC, DO, TELOPT_BINARY, '\0' };		write(fd, will_echo_cmd, sizeof(will_echo_cmd));	write(fd, will_sga_cmd, sizeof(will_sga_cmd));	write(fd, dont_linemode_cmd, sizeof(dont_linemode_cmd));	write(fd, do_window_size_cmd, sizeof(do_window_size_cmd));	write(fd, do_transmit_binary_cmd, sizeof(do_transmit_binary_cmd));    }        snprintf(buf, sizeof(buf), "%s%s", cli_welcome, newline());    write(fd, buf, strlen(buf));    snprintf(buf, sizeof(buf), "%s", cli_prompt);    write(fd, buf, strlen(buf));            _fd_file_read = fdopen(fd, "r");    _fd_file_write = fdopen(fd, "w");    _gl = new_GetLine(1024, 2048);    if (_gl == NULL)	exit (1);        /* Change the input and output streams for libtecla */    if (gl_change_terminal(_gl, _fd_file_read, _fd_file_write, NULL) != 0) {	_gl = del_GetLine(_gl);	exit (1);    }}voidclient_read(int fd){    char *line = NULL;    char buf[1024];    int i, n, ret_value;    /*     * XXX: Peek at the data, and later it will be read     * by the command-line processing library     */    n = recv(fd, buf, sizeof(buf), MSG_PEEK);    for (i = 0; i < n; i++)	printf("VAL = %d\n", buf[i]);        printf("client_read %d octets\n", n);    if (n <= 0) {	exit (0);    }        /* Scan the input data and filter-out the Telnet commands */    for (i = 0; i < n; i++) {	uint8_t val = buf[i];		if (val == IAC) {	    /* Probably a telnet command */	    if (! _telnet_iac) {		_telnet_iac = 1;		goto post_process_telnet_label;	    }	    _telnet_iac = 0;	}	if (_telnet_iac) {	    switch (val) {	    case SB:		/* Begin subnegotiation of the indicated option. */		_telnet_sb_buffer_size = 0;		_telnet_sb = 1;		break;	    case SE:		/* End subnegotiation of the indicated option. */		if (! _telnet_sb)		    break;		switch(_telnet_sb_buffer[0]) {		case TELOPT_NAWS:		    /* Telnet Window Size Option */		    if (_telnet_sb_buffer_size < 5)			break;		    {			_window_width			    = 256 * _telnet_sb_buffer[1];			_window_width			    += _telnet_sb_buffer[2];			_window_height			    = 256 * _telnet_sb_buffer[3];			_window_height			    += _telnet_sb_buffer[4];			printf("Client window size changed to width = %d "			       "height = %d\n",			       _window_width, _window_height);		    }		    break;		default:		    break;		}		_telnet_sb_buffer_size = 0;		_telnet_sb = 0;		break;	    case DONT:		/* you are not to use option */		_telnet_dont = 1;		break;	    case DO:		/* please, you use option */		_telnet_do = 1;		break;	    case WONT:		/* I won't use option */		_telnet_wont = 1;		break;	    case WILL:		/* I will use option */		_telnet_will = 1;		break;	    case GA:		/* you may reverse the line */		break;	    case EL:		/* erase the current line */		break;	    case EC:		/* erase the current character */		break;	    case AYT:		/* are you there */		break;	    case AO:		/* abort output--but let prog finish */		break;	    case IP:		/* interrupt process--permanently */		break;	    case BREAK:		/* break */		break;	    case DM:		/* data mark--for connect. cleaning */		break;	    case NOP:		/* nop */		break;	    case EOR:		/* end of record (transparent mode) */		break;	    case ABORT:		/* Abort process */		break;	    case SUSP:		/* Suspend process */		break;	    case xEOF:		/* End of file: EOF is already used... */		break;	    default:		break;	    }	    _telnet_iac = 0;	    goto post_process_telnet_label;	}	if (_telnet_sb) {	    /* A negotiated option value */	    _telnet_sb_buffer[_telnet_sb_buffer_size] = val;	    if ( ++_telnet_sb_buffer_size >= sizeof(_telnet_sb_buffer)) {		/* This client is sending too much options. Kick it out! */		printf("Removing client!\n");		exit (1);	    }	    goto post_process_telnet_label;	}	if (_telnet_dont) {	    /* Telnet DONT option code */	    _telnet_dont = 0;	    goto post_process_telnet_label;	}	if (_telnet_do) {	    /* Telnet DO option code */	    _telnet_do = 0;	    goto post_process_telnet_label;	}	if (_telnet_wont) {	    /* Telnet WONT option code */	    _telnet_wont = 0;	    goto post_process_telnet_label;	}	if (_telnet_will) {	    /* Telnet WILL option code */	    _telnet_will = 0;	    goto post_process_telnet_label;	}		line = gl_get_line_net(_gl,			       CLI_PROMPT,			       _command_buffer,			       _buff_curpos);	fflush(_fd_file_write);		/* Store the line in the command buffer */	if (line != NULL) {	    if ((val == '\n') || (val == '\r')) {		/* New command */		fprintf(_fd_file_write, "Your command is: %s%s",			line, newline());		fflush(_fd_file_write);		fprintf(_fd_file_write, "%s", CLI_PROMPT);		fflush(_fd_file_write);		_command_buffer_size = 0;		_command_buffer[0] = '\0';	    } else {		/* Same-line character */		int gl_buff_curpos = gl_get_buff_curpos(_gl);		if (command_line_character(line, gl_buff_curpos, val)) {		    int i;		    /* We need to print this character */		    _command_buffer_size = 0;		    _command_buffer[0] = '\0';		    ret_value = 0;		    for (i = 0; line[i] != '\0'; i++) {			_command_buffer[_command_buffer_size] = line[i];			if (++_command_buffer_size >= sizeof(_command_buffer))			    ret_value = -1;			if (ret_value < 0)			    break;		    }		    if (ret_value == 0)			_command_buffer[_command_buffer_size] = '\0';		    if (++_command_buffer_size >= sizeof(_command_buffer))			ret_value = -1;		    if (ret_value != 0) {			/* This client is sending too much data. Kick it out!*/			printf("Removing client!\n");			exit (1);		    }		    _buff_curpos = gl_buff_curpos;		}	    }	}	fflush(_fd_file_write);	continue;	    post_process_telnet_label:	recv(fd, buf, 1, 0); /* Read-out this octet */	continue;    }}/** * command_line_character: * @line: The current command line. * @word_end: The cursor position. * @val: The last typed character. *  * Have a peek in the last type character and perform any special actions * if needed. *  * Return value: 1 to output this character, otherwise 0 **/intcommand_line_character(const char *line, int word_end, uint8_t val){    if (val == '?') {		fprintf(_fd_file_write, "%sThis is a help!%s", newline(), newline());	fflush(_fd_file_write);	fprintf(_fd_file_write, "%s", CLI_PROMPT);	fflush(_fd_file_write);	fprintf(_fd_file_write, "%s", _command_buffer);	fflush(_fd_file_write);	return (0);    }    return (1);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99视频有精品| 国产欧美精品日韩区二区麻豆天美| 欧美一区永久视频免费观看| 国产精品高潮呻吟久久| 国产麻豆91精品| 久久夜色精品国产欧美乱极品| 午夜精品久久久久久久| 一本色道综合亚洲| 亚洲男同性恋视频| 色诱亚洲精品久久久久久| 日韩美女啊v在线免费观看| 成人黄色小视频在线观看| 国产精品人成在线观看免费| 粉嫩av一区二区三区粉嫩| 亚洲国产精品黑人久久久| 成人在线视频一区二区| 亚洲免费av高清| 欧美精品在线一区二区| 久久9热精品视频| 欧美精品777| 亚洲免费观看高清完整| 欧美午夜视频网站| 免费成人在线网站| 久久久久国产成人精品亚洲午夜| 丁香亚洲综合激情啪啪综合| 亚洲图片激情小说| 欧亚一区二区三区| 国内不卡的二区三区中文字幕| 日本一区二区三区免费乱视频| 91在线免费视频观看| 久久国产精品区| 亚洲第一主播视频| 久久精品欧美一区二区三区不卡| 色天使色偷偷av一区二区| 免费人成黄页网站在线一区二区| 中文字幕成人在线观看| 欧美一区二区三区免费在线看| 国产麻豆视频一区| 亚洲综合色婷婷| 亚洲色图丝袜美腿| 欧美韩国日本一区| 2欧美一区二区三区在线观看视频| 色菇凉天天综合网| 成人午夜又粗又硬又大| 美女视频网站久久| 亚洲福利视频三区| 一区二区三区免费在线观看| 国产欧美精品一区aⅴ影院| 精品欧美一区二区三区精品久久| 欧美久久久一区| 欧美日韩一级视频| 99久久精品免费看国产| 国产成人精品午夜视频免费 | 欧美日韩国产在线播放网站| 色综合亚洲欧洲| 欧美视频一区二区三区在线观看 | 激情欧美一区二区| 日本麻豆一区二区三区视频| 蜜臀99久久精品久久久久久软件| 日韩福利电影在线观看| 久久国产精品露脸对白| 国产精品一区一区| 91香蕉国产在线观看软件| 欧美在线免费观看视频| 欧美日韩日日夜夜| 久久久综合九色合综国产精品| 久久久国产精品午夜一区ai换脸| 久久久久久久久岛国免费| 国产精品色婷婷| 亚洲成人午夜电影| 国产精品中文字幕日韩精品 | 欧美一区二区视频在线观看2020| 欧美三级日韩三级国产三级| 欧美一区二区在线免费播放| 久久综合狠狠综合| 亚洲小说春色综合另类电影| 日韩精品成人一区二区在线| 青椒成人免费视频| 国产精品影音先锋| 欧美亚洲尤物久久| 国产日产精品1区| 狠狠v欧美v日韩v亚洲ⅴ| 一个色在线综合| 毛片av中文字幕一区二区| 91在线你懂得| 久久精品亚洲麻豆av一区二区| 亚洲青青青在线视频| 国产精一区二区三区| 欧美午夜电影一区| 亚洲欧美色综合| 99re热这里只有精品视频| 欧美r级在线观看| 日本91福利区| 性感美女久久精品| 欧美剧情电影在线观看完整版免费励志电影| 国内外成人在线| www.日韩av| 国产精品萝li| av激情亚洲男人天堂| 国产日韩欧美综合一区| 国产成人免费网站| 久久天堂av综合合色蜜桃网 | 欧美三日本三级三级在线播放| 国产精品美女久久福利网站| 国产乱码字幕精品高清av | 免费在线观看一区二区三区| 欧美在线一二三| 天天影视网天天综合色在线播放| 欧美亚洲高清一区二区三区不卡| 一区二区中文视频| 91久久国产最好的精华液| 亚洲国产精品国自产拍av| 99国产精品久久久久久久久久久 | 日韩色在线观看| 国产福利一区二区三区视频| 欧美国产综合色视频| 99re成人在线| 免费在线欧美视频| 国产精品欧美精品| 欧美性色黄大片| 免费高清在线视频一区·| 国产日韩欧美精品综合| 日本高清视频一区二区| 日本欧美肥老太交大片| 国产精品第一页第二页第三页| 欧美主播一区二区三区| 美女一区二区久久| 亚洲精选视频免费看| 精品国产一区二区精华| 91丨九色丨蝌蚪丨老版| 麻豆国产欧美日韩综合精品二区| 精品免费一区二区三区| 欧美少妇性性性| 国产麻豆精品在线观看| 婷婷久久综合九色国产成人| 亚洲欧洲国产专区| 久久久久久毛片| 日韩免费电影一区| 欧美亚洲日本一区| 99re这里只有精品视频首页| 韩国女主播成人在线| 亚洲福利一区二区三区| 亚洲视频狠狠干| 中文字幕电影一区| 中文字幕不卡在线| 久久久久久久久久久久久久久99| 欧美一区午夜精品| 欧美精选一区二区| 波多野结衣欧美| 成人美女视频在线观看18| 久久99国产精品久久99果冻传媒| 亚洲大片一区二区三区| 一区二区三区美女| 亚洲国产精品久久一线不卡| 亚洲色图一区二区三区| 亚洲夂夂婷婷色拍ww47| 亚洲制服欧美中文字幕中文字幕| 亚洲免费伊人电影| 亚洲一区二区三区四区五区黄| 亚洲视频你懂的| 亚洲成在线观看| 久久国产剧场电影| 国产成人在线观看| 在线一区二区三区做爰视频网站| 日本精品一区二区三区高清 | 91最新地址在线播放| 精品视频123区在线观看| 日韩精品中文字幕在线一区| 2023国产精品视频| 亚洲综合色噜噜狠狠| 久久激情综合网| 色丁香久综合在线久综合在线观看| 在线观看精品一区| 精品久久久久久久久久久久包黑料| 欧美国产一区视频在线观看| 一区二区三区色| 人人狠狠综合久久亚洲| 一区二区三区在线视频播放| 免费观看在线综合| 91国偷自产一区二区三区观看| 欧美视频完全免费看| 中文字幕一区二区视频| 美国十次了思思久久精品导航| 成人av高清在线| 久久人人97超碰com| 日韩在线观看一区二区| 成人午夜精品在线| 日韩欧美你懂的| 亚洲6080在线| 欧美三级蜜桃2在线观看| 亚洲精选视频免费看| 丰满亚洲少妇av| 国产日韩欧美一区二区三区乱码| 日本视频免费一区| 欧美日韩高清一区| 亚洲成av人片在线| 欧美喷水一区二区| 天天色天天操综合| 欧美α欧美αv大片| 免费欧美日韩国产三级电影|