TFTP: replace "server" with "remote" in local variable names

With the upcoming TFTP server implementation, the remote node can be
either a client or a server, so avoid ambiguities.

Signed-off-by: Luca Ceresoli <luca.ceresoli@comelit.it>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Detlev Zundel <dzu@denx.de>
master
Luca Ceresoli 13 years ago committed by Wolfgang Denk
parent 9bb0a1bf98
commit 20478ceaa2
  1. 28
      net/tftp.c

@ -58,9 +58,9 @@ enum {
TFTP_ERR_FILE_ALREADY_EXISTS = 6, TFTP_ERR_FILE_ALREADY_EXISTS = 6,
}; };
static IPaddr_t TftpServerIP; static IPaddr_t TftpRemoteIP;
/* The UDP port at their end */ /* The UDP port at their end */
static int TftpServerPort; static int TftpRemotePort;
/* The UDP port at our end */ /* The UDP port at our end */
static int TftpOurPort; static int TftpOurPort;
static int TftpTimeoutCount; static int TftpTimeoutCount;
@ -289,7 +289,7 @@ TftpSend(void)
break; break;
} }
NetSendUDPPacket(NetServerEther, TftpServerIP, TftpServerPort, NetSendUDPPacket(NetServerEther, TftpRemoteIP, TftpRemotePort,
TftpOurPort, len); TftpOurPort, len);
} }
@ -309,7 +309,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
#endif #endif
return; return;
} }
if (TftpState != STATE_RRQ && src != TftpServerPort) if (TftpState != STATE_RRQ && src != TftpRemotePort)
return; return;
if (len < 2) if (len < 2)
@ -333,7 +333,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
pkt, pkt,
pkt + strlen((char *)pkt) + 1); pkt + strlen((char *)pkt) + 1);
TftpState = STATE_OACK; TftpState = STATE_OACK;
TftpServerPort = src; TftpRemotePort = src;
/* /*
* Check for 'blksize' option. * Check for 'blksize' option.
* Careful: "i" is signed, "len" is unsigned, thus * Careful: "i" is signed, "len" is unsigned, thus
@ -405,7 +405,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
if (TftpState == STATE_RRQ || TftpState == STATE_OACK) { if (TftpState == STATE_RRQ || TftpState == STATE_OACK) {
/* first block received */ /* first block received */
TftpState = STATE_DATA; TftpState = STATE_DATA;
TftpServerPort = src; TftpRemotePort = src;
TftpLastBlock = 0; TftpLastBlock = 0;
TftpBlockWrap = 0; TftpBlockWrap = 0;
TftpBlockWrapOffset = 0; TftpBlockWrapOffset = 0;
@ -440,7 +440,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
/* /*
* Acknoledge the block just received, which will prompt * Acknoledge the block just received, which will prompt
* the server for the next one. * the remote for the next one.
*/ */
#ifdef CONFIG_MCAST_TFTP #ifdef CONFIG_MCAST_TFTP
/* if I am the MasterClient, actively calculate what my next /* if I am the MasterClient, actively calculate what my next
@ -569,7 +569,7 @@ TftpStart(void)
debug("TFTP blocksize = %i, timeout = %ld ms\n", debug("TFTP blocksize = %i, timeout = %ld ms\n",
TftpBlkSizeOption, TftpTimeoutMSecs); TftpBlkSizeOption, TftpTimeoutMSecs);
TftpServerIP = NetServerIP; TftpRemoteIP = NetServerIP;
if (BootFile[0] == '\0') { if (BootFile[0] == '\0') {
sprintf(default_filename, "%02lX%02lX%02lX%02lX.img", sprintf(default_filename, "%02lX%02lX%02lX%02lX.img",
NetOurIP & 0xFF, NetOurIP & 0xFF,
@ -589,7 +589,7 @@ TftpStart(void)
strncpy(tftp_filename, BootFile, MAX_LEN); strncpy(tftp_filename, BootFile, MAX_LEN);
tftp_filename[MAX_LEN-1] = 0; tftp_filename[MAX_LEN-1] = 0;
} else { } else {
TftpServerIP = string_to_ip(BootFile); TftpRemoteIP = string_to_ip(BootFile);
strncpy(tftp_filename, p + 1, MAX_LEN); strncpy(tftp_filename, p + 1, MAX_LEN);
tftp_filename[MAX_LEN-1] = 0; tftp_filename[MAX_LEN-1] = 0;
} }
@ -599,14 +599,14 @@ TftpStart(void)
printf("Using %s device\n", eth_get_name()); printf("Using %s device\n", eth_get_name());
#endif #endif
printf("TFTP from server %pI4" printf("TFTP from server %pI4"
"; our IP address is %pI4", &TftpServerIP, &NetOurIP); "; our IP address is %pI4", &TftpRemoteIP, &NetOurIP);
/* Check if we need to send across this subnet */ /* Check if we need to send across this subnet */
if (NetOurGatewayIP && NetOurSubnetMask) { if (NetOurGatewayIP && NetOurSubnetMask) {
IPaddr_t OurNet = NetOurIP & NetOurSubnetMask; IPaddr_t OurNet = NetOurIP & NetOurSubnetMask;
IPaddr_t ServerNet = TftpServerIP & NetOurSubnetMask; IPaddr_t RemoteNet = TftpRemoteIP & NetOurSubnetMask;
if (OurNet != ServerNet) if (OurNet != RemoteNet)
printf("; sending through gateway %pI4", printf("; sending through gateway %pI4",
&NetOurGatewayIP); &NetOurGatewayIP);
} }
@ -630,7 +630,7 @@ TftpStart(void)
NetSetTimeout(TftpTimeoutMSecs, TftpTimeout); NetSetTimeout(TftpTimeoutMSecs, TftpTimeout);
NetSetHandler(TftpHandler); NetSetHandler(TftpHandler);
TftpServerPort = WELL_KNOWN_PORT; TftpRemotePort = WELL_KNOWN_PORT;
TftpTimeoutCount = 0; TftpTimeoutCount = 0;
TftpState = STATE_RRQ; TftpState = STATE_RRQ;
/* Use a pseudo-random port unless a specific port is set */ /* Use a pseudo-random port unless a specific port is set */
@ -639,7 +639,7 @@ TftpStart(void)
#ifdef CONFIG_TFTP_PORT #ifdef CONFIG_TFTP_PORT
ep = getenv("tftpdstp"); ep = getenv("tftpdstp");
if (ep != NULL) if (ep != NULL)
TftpServerPort = simple_strtol(ep, NULL, 10); TftpRemotePort = simple_strtol(ep, NULL, 10);
ep = getenv("tftpsrcp"); ep = getenv("tftpsrcp");
if (ep != NULL) if (ep != NULL)
TftpOurPort = simple_strtol(ep, NULL, 10); TftpOurPort = simple_strtol(ep, NULL, 10);

Loading…
Cancel
Save