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

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

?? tftp.c

?? 針對德州儀器DM270開發板的bootloader,其實現了內核的下載以及文件系統的下載
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * File: tftp.c * * This is an implementation of a tftp.h interface. This implementation * supplies a file byte stream as pulled from the UDP/IP/ether network stack * via TFTP. * * See Also *   tftp.h * * Copyright (C) 2002 RidgeRun, Inc. * Author: RidgeRun, Inc  <skranz@ridgerun.com> * *  This program is free software; you can redistribute  it and/or modify it *  under  the terms of  the GNU General  Public License as published by the *  Free Software Foundation;  either version 2 of the  License, or (at your *  option) any later version. * *  THIS  SOFTWARE  IS  PROVIDED  ``AS  IS''  AND   ANY  EXPRESS  OR IMPLIED *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT,  INDIRECT, *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *  You should have received a copy of the  GNU General Public License along *  with this program; if not, write  to the Free Software Foundation, Inc., *  675 Mass Ave, Cambridge, MA 02139, USA. * * Please report all bugs/problems to the author or <support@dsplinux.net> * * key: RRGPLCR (do not remove) * *//////////////////////////////////////////////////////////   A typical TFTP session goes like this:////     1. Device sends the read request to the remote server//        indicating the filename of interest and the UDP port//        number which is to receive the file blocks.//     2. Remote server sends the next 512 bytes of the file//        to the requesting device/port.//     3. Device processes the block of bytes and sends//        the remote server a TFTP ACK datagram signaling the//        server that the device is ready for the next block.//     4. goto step 2. Process continues until the last byte//        of the file has been retrieved. Device finishes//        up with a final TFTP ACK to the remote server after//        recieving the last block from the server.//        Last block can be identified by the one the has//        less than 512 bytes or has 0 bytes.////        For more info see page 427,//        "Internetworking With TCP/IP (3rd edition, vol 1)"///////////////////////////////////////////////////////#include "types.h"#include "io.h"#include "net.h"#include "util.h"#include "tftp.h"#define NORM_TFTP_PORT 69#define TFTP_RRQ   1#define TFTP_WRQ   2#define TFTP_DATA  3#define TFTP_ACK   4#define TFTP_ERROR 5typedef enum {  do_RRQ,  do_ACK} dg_type_t;#define MAX_FNAME_CHAR 200typedef struct {  unsigned short opcode;  unsigned char fname_and_mode[MAX_FNAME_CHAR]; // hmmm? that should be plenty.} tftp_RRQ_datagram_t;typedef struct {  unsigned short opcode;  unsigned char fname_and_mode[MAX_FNAME_CHAR]; // hmmm? that should be plenty.} tftp_WRQ_datagram_t;typedef struct {  unsigned short opcode;  unsigned short block_num;  unsigned char block_buff[512]; // size as per page 428, "Internetworking With TCP/IP (3rd edition, vol 1)"} tftp_DATA_datagram_t; // total bytes 516.typedef struct {  unsigned short opcode;  unsigned short block_num;} tftp_ACK_datagram_t;typedef struct {  unsigned short opcode;  unsigned short err_code;  unsigned char err_msg[MAX_FNAME_CHAR]; // hmmm? that should be plenty.} tftp_ERROR_datagram_t;// --tftp_datagram_t--// This datagram can take on any one of these// specific formats.  Of course, one at a time// since this is a "union" not a "struct".typedef union {  unsigned short opcode; // first 2 bytes indicate which format applies.  tftp_RRQ_datagram_t   RRQ;  tftp_WRQ_datagram_t   WRQ;  tftp_DATA_datagram_t  DATA;  tftp_ACK_datagram_t   ACK;  tftp_ERROR_datagram_t ERROR;} tftp_datagram_t; // total bytes 516 (the largest component of this union).// --full_ether_frame_t--// This memory represents the full buffer space needed// by the various levels of the network stack extending// from TFTP down to the ether chipset. The TFTP layer// will only deal with tftp_data_gram field and as we// pass it to the network stack the other fields will// be supplied as the datagram is furthur prepared before// finally being sent to the remote server as a full// ether frame.typedef struct {  ether_hdr_t reserved_space1;  ip_hdr_t reserved_space2;  udp_hdr_t reserved_space3;  tftp_datagram_t tftp_data_gram;  long dummy1; // See Note below} __attribute__ ((packed)) full_ether_frame_t;// Note: the dummy1 field just insures that we//       tack on an extra 32bits worth to give the//       underlying ethernet implementation used the//       freedom to round-up the incoming packet size//       to the nearest 32bit boudary and still have//       the bytes contained within what we define to//       be the longest ether frame. They may chose//       to round up for speed reasons.// Okay, I've carefully added up the number of bytes that// full_ether_frame_t should contain assuming no compiler// padding. We don't want compiler padding since the// network specs require contiguous fields side-by-side// with no compiler ejected padding. The following// constant will help us catch the padding case at// run-time. If one day we switch to a compiler that does// the padding we'll have to re-architect the way we've// currently choosen to express the full_ether_frame_t here.#define SIZEFULLFRAME (562)// Note:// The Start_Of_Session is a global variable that was added// to work around some network issues discovered on the c5471// platform. The idea is that sometimes the first tftp packet// will not arrive at the destination machine -- so a workaround// at the lowest levels (ether_c5471.c) was to recognize the// start of a tftp session so that if no response arrived at// the ether driver in X milliseconds following the outgoing// tftp packet, then it could retry the packet xmit a number// of times in the hopes to get things going. It seems that// once that first packet arrived at the destination machine// then the remaining packets of the TFTP session seemed to// go fine. The issue seemed to be getting that first packet// of a session to go out. Skranz Jan 2002.//int Start_Of_Session; // See Note Above.static full_ether_frame_t full_ether_frame;static tftp_datagram_t *data_gram;static unsigned char *block_buff_curr;static unsigned char *block_buff_end;static int new_connection;static int Whole_file_xferred;static unsigned short expected_block_num;static unsigned short reply_port;static char tftp_filename[MAX_FNAME_CHAR]; // hmmm?, should be plenty.static char tftp_device_IP[16]; // standard size. "100.200.300.400\0"static char tftp_server_IP[16]; // standard size. "100.200.300.400\0"static char tftp_device_MAC[18];// standard size. "00:e0:81:10:36:cf\0"static char tftp_server_MAC[18];// standard size. "00:50:DA:CC:5D:09\0"/****************************** Routine: Description:    Build a tftp datagram as per page 428,    "Internetworking With TCP/IP (3rd edition, vol 1)" ******************************/static void build_tftp_datagram(dg_type_t type,            // in                                tftp_datagram_t *data_g,   // out                                unsigned short *num_bytes) // out{   unsigned char *curr;   curr = (unsigned char *) data_g;   *num_bytes = 0;   switch (type) {     case do_RRQ:       *((unsigned short *)curr) = htons(TFTP_RRQ);       curr += 2;       util_strcpy (curr,tftp_filename);       curr += util_strlen(tftp_filename) + 1;       util_strcpy (curr, "octet");       curr += util_strlen("octet") + 1;       *num_bytes = curr - (unsigned char *)data_g;       break;     case do_ACK:       data_g->DATA.opcode = htons(TFTP_ACK);       data_g->DATA.block_num = htons(expected_block_num-1);       *num_bytes = sizeof(tftp_ACK_datagram_t);       break;     default:       SYSTEM_FATAL("Logic Error");       break;   }}/****************************** Routine: Description:    See tftp.h for more info. ******************************/void connect_tftp(char *device_IP,                  char *server_IP,                  char *device_MAC, // MACs may be NULL only if                   char *server_MAC,   // our network stack has ARP.                  char *fname){  // Just cache the values locally so we'll have them  // when we need them for the client's upcoming calls  // to getchar_tftp().  util_strcpy(tftp_filename,fname);  util_strcpy(tftp_device_IP,device_IP);  util_strcpy(tftp_server_IP,server_IP);  util_strcpy(tftp_device_MAC,device_MAC);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区日韩| 婷婷开心久久网| 精品国产一区二区三区不卡 | 国产拍揄自揄精品视频麻豆| 欧美亚洲综合另类| 在线欧美一区二区| 在线视频国内一区二区| 欧美自拍丝袜亚洲| 欧美日韩久久久一区| 欧美人与性动xxxx| 日韩欧美成人激情| 久久夜色精品国产噜噜av | 麻豆精品在线看| 国内精品在线播放| 高清不卡在线观看av| 成人亚洲一区二区一| 色欲综合视频天天天| 欧美日韩午夜精品| 日韩欧美123| 国产校园另类小说区| 一区二区中文视频| 亚洲成人7777| 国产在线精品一区在线观看麻豆| 美日韩一级片在线观看| 国产剧情一区二区三区| 91网上在线视频| 91精品国产色综合久久不卡蜜臀| 91麻豆精品国产自产在线观看一区| 欧美三级在线播放| 精品久久一区二区三区| 亚洲情趣在线观看| 久久99精品久久久久久国产越南| 国模冰冰炮一区二区| 99re热视频这里只精品| 欧美电影影音先锋| 中文在线免费一区三区高中清不卡| 国产精品女同互慰在线看| 亚洲影院理伦片| 国产伦精一区二区三区| 欧美主播一区二区三区| xfplay精品久久| 亚洲一区二区不卡免费| 国产成人综合在线| 91精品国产91综合久久蜜臀| 国产午夜一区二区三区| 日韩av中文字幕一区二区三区| 久久精品噜噜噜成人av农村| 色欲综合视频天天天| 日本一区二区三区国色天香| 亚洲va天堂va国产va久| 99久久精品国产观看| 精品日韩一区二区三区免费视频| 国产精品国产三级国产aⅴ无密码| 亚洲综合久久久| 成人小视频在线观看| 精品国产欧美一区二区| 亚洲成人免费看| 一本色道综合亚洲| 国产精品日韩成人| 韩国视频一区二区| 日韩精品一区二区三区视频在线观看| 精品久久一二三区| 日韩二区三区四区| 欧美日韩国产乱码电影| 一区二区三区欧美亚洲| 9人人澡人人爽人人精品| 精品国产第一区二区三区观看体验| 有坂深雪av一区二区精品| 99久久婷婷国产综合精品电影| 日韩欧美国产一区二区在线播放 | 91亚洲国产成人精品一区二区三| 欧美成人激情免费网| 日韩国产精品久久久久久亚洲| 色哟哟国产精品免费观看| 亚洲三级在线看| 色综合av在线| 亚洲成人av一区二区三区| 欧洲精品一区二区三区在线观看| 中文在线资源观看网站视频免费不卡| 日韩中文字幕亚洲一区二区va在线| 97精品国产露脸对白| 亚洲天堂av一区| 97久久超碰国产精品| 亚洲综合网站在线观看| 欧美在线免费观看视频| 三级影片在线观看欧美日韩一区二区| 成人免费观看男女羞羞视频| 中文字幕五月欧美| 欧美自拍丝袜亚洲| 奇米精品一区二区三区在线观看一 | 一区二区三区资源| 色婷婷精品大在线视频| 性欧美大战久久久久久久久| 欧美一级欧美三级在线观看| 老司机一区二区| 欧美mv和日韩mv的网站| 国产高清在线观看免费不卡| 国产精品萝li| 欧美色欧美亚洲另类二区| 日本不卡123| 欧美国产成人精品| 欧美美女网站色| 国产伦理精品不卡| 亚洲香肠在线观看| 精品国偷自产国产一区| 9i看片成人免费高清| 日日夜夜免费精品| 国产精品毛片a∨一区二区三区| 国产成人av网站| 亚洲一区二区三区视频在线| 欧美一级欧美一级在线播放| 成人高清视频在线| 日韩中文字幕不卡| 国产精品蜜臀av| 7777精品伊人久久久大香线蕉的| 视频精品一区二区| 国产精品久久久久久久久图文区 | 自拍视频在线观看一区二区| 欧美日韩精品一区二区三区四区 | 国产成人免费视频网站| 亚洲国产日产av| 欧美精彩视频一区二区三区| 欧美日韩一区二区欧美激情| 国产精品996| 日本一道高清亚洲日美韩| 国产精品欧美一区喷水| 精品久久久久久无| 欧美日本在线观看| 91网址在线看| 丰满少妇久久久久久久| 麻豆91精品91久久久的内涵| 亚洲精品写真福利| 国产精品久久久久三级| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 蜜桃视频一区二区三区在线观看| 欧美r级在线观看| 精品视频在线免费看| 丁香桃色午夜亚洲一区二区三区| 亚洲va中文字幕| 一区二区成人在线观看| 国产精品美女一区二区在线观看| 69久久99精品久久久久婷婷| 在线看日韩精品电影| 成人激情午夜影院| 国产黄色91视频| 国产成人亚洲精品青草天美| 久久精品国产精品亚洲红杏| 热久久免费视频| 日韩福利视频网| 热久久国产精品| 久久er精品视频| 美女任你摸久久| 久久国产日韩欧美精品| 久久国产精品免费| 国产一区二区三区最好精华液| 婷婷久久综合九色国产成人| 亚洲图片一区二区| 午夜精品久久久久久久蜜桃app| 综合久久久久综合| 一二三区精品福利视频| 亚洲午夜电影在线观看| 天堂久久久久va久久久久| 无吗不卡中文字幕| 青青国产91久久久久久 | 麻豆成人久久精品二区三区小说| 亚洲妇熟xx妇色黄| 日韩精彩视频在线观看| 日韩精品一二三| 九一九一国产精品| 国产99久久久精品| 99re亚洲国产精品| 欧美精品在线一区二区三区| 91精品国产高清一区二区三区蜜臀| 欧美日韩中文精品| 精品成人在线观看| 中文乱码免费一区二区| 亚洲欧美日本在线| 日日夜夜精品视频天天综合网| 亚洲一区二区三区小说| 捆绑调教一区二区三区| 国产不卡免费视频| 欧美亚洲丝袜传媒另类| 精品成人在线观看| 一区二区三区不卡在线观看| 麻豆精品一区二区av白丝在线| 国产一区日韩二区欧美三区| 91麻豆文化传媒在线观看| 欧美裸体bbwbbwbbw| 久久久久国色av免费看影院| 亚洲综合另类小说| 国产成人高清视频| 欧美亚洲丝袜传媒另类| 久久久久久一级片| 视频一区在线视频| 本田岬高潮一区二区三区| 日韩午夜在线影院| 椎名由奈av一区二区三区| 久色婷婷小香蕉久久| 欧美视频日韩视频| 中文字幕国产一区|