资源简介
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
- 上一篇:常用哈希算法代码实现
- 下一篇:人事管理系统 人事管理系统
相关资源
- 蓝牙源代码应用于LINUX
- Borland Socket Server Fix2.0 D7
- Borland Socket Server程序 包含D6和D7源码
- Azure开发教程:Azure_Serverless_Computing
- USB.Over.Network.Server 注册机
- uboot到linux logo显示不间断 补丁
- Uninstall_Cortana_WINCLIENT.CN.rar
- UNIX/LINUX编程实践教程的源码
- B/S 网上订餐系统
- Linux任务管理器
- linux应用层的华容道游戏源代码
- ubuntu9.10 可加载内核模块和字符设备驱
- MP3文件ID3v2ID3v2APEv2标签读取
- 操作系统实验——虚存管理实验
- linux下的发包工具sendip
- 尚观培训linux许巍关于c 的笔记和讲义
- 尚观培训linux董亮老师关于数据结构的
- linux 线程池源码 c 版
- tftp文件传输工具
- linux C 电梯程序练习
- 代码客:G-TcpServer(IOCP) 1.0 正式版及
- linux下用多进程同步方法解决生产者
- Linux 操作系统实验(全)
- Linux From Scratch 中文手册
- linux 网络实验 ftp程序
- Linux命令大全离线版&在线版
- 操作系统共享内存实验
- dos 下运行Linux 命令--gnu_utils
- linux 0.12内核源代码
- linux简易shell C实现
评论
共有 条评论