资源简介
linux下的tftp server端的源码,大家共同来研究
代码片段和文件信息
*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation
* advertising materials and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ‘‘AS IS‘‘ AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES INCLUDING WITHOUT LIMITATION THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef lint
char copyright[] =
“@(#) Copyright (c) 1983 Regents of the University of California.\n\
All rights reserved.\n“;
#endif /* not lint */
#ifndef lint
static char sccsid[] = “@(#)tftpd.c 5.8 (Berkeley) 6/18/88“;
#endif /* not lint */
/*
* Trivial file transfer protocol server.
*
* This version includes many modifications by Jim Guyton
*
* Further modifications by Markus Gutschke
* - RFC1782 option parsing
* - RFC1783 extended blocksize
* - “-c“ option for changing the root directory
* - “-d“ option for debugging output
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define TIMEOUT 5
#ifndef OACK
#define OACK 06
#endif
#ifndef EOPTNEG
#define EOPTNEG 8
#endif
extern int errno;
struct sockaddr_in sin = { AF_INET };
int peer;
int rexmtval = TIMEOUT;
int maxtimeout = 5*TIMEOUT;
#define PKTSIZE (1432+4) /* SEGSIZE+4 */
int segsize = SEGSIZE;
char buf[PKTSIZE];
char ackbuf[PKTSIZE];
struct sockaddr_in from;
int fromlen;
char *rootdir = NULL;
int debug = 0;
struct filters {
struct filters *next;
char *fname;
} *filters = NULL;
int isfilter = 0;
main(argc argv)
char *argv[];
{
register struct tftphdr *tp;
register int n;
int on = 1;
extern int optind;
extern char *optarg;
openlog(argv[0] LOG_PID LOG_DAEMON);
while ((n = getopt(argc argv “c:dr:“)) >= 0) {
switch (n) {
case ‘c‘:
if (rootdir)
goto usage;
rootdir = optarg;
break;
case ‘d‘:
debug++;
break;
case ‘r‘: {
struct filters *fp = (void *)
malloc(sizeof(struc
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 268517 2006-09-26 18:45 rfc1350.pdf
文件 20841 2004-12-23 15:31 tftp_server_linux.c
----------- --------- ---------- ----- ----
289576 3
- 上一篇:常用哈希算法代码实现
- 下一篇:人事管理系统 人事管理系统
相关资源
- 操作系统课程设计-实现系统状态监测
- FTP客户端C源码(Linux版)
- linux入侵检测源代码简单
- VisualSVN Server增加网页密码修改功能
- arcgis server 10.3
- TCP服务器端和客户端收发测试程序亲
- kepserver UA教程.docx
- PXE网络启动批量安装Linux系统
- Linux_期末考试试题8套(含答案)245
- 在linux中实现一个命令执行程序doit
- cmd命令大全(最全最权威).pdf
- linux下读写ini配置文件(与windows API一
- 2003 server standard edition 产品密钥和其它
- VirtualBox实现文件夹共享
- linux驱动编写ppt
- linux下的U盘驱动程序
- pwn学习历程.pdf
- linux下dhcp软件包
- Linux下posix线程实现的定时器
- redis RPM完整安装包
- linux下飞鸽传书
- linux ipv6简单tcp/udp socket通信
- qt网络五子棋
- linux c tcp socket 多线程简易聊天室
- rk3288平台深度学习框架caffe+opencv环境
- 最新的libssh2库源码
- LINUX 串口与SPI操作
- 嵌入式Linux应用系统开发精讲源码
- tftp server —一个简易的 tftp 服务器
- 深入理解计算机系统原书第三版超高
评论
共有 条评论