All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca.ceresoli@comelit.it>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/6] TFTP: rename "server" to "remote"
Date: Thu, 14 Apr 2011 17:52:54 +0200	[thread overview]
Message-ID: <1302796377-3321-4-git-send-email-luca.ceresoli@comelit.it> (raw)
In-Reply-To: <4DA5682A.8040203@comelit.it>

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>
---
 net/tftp.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/net/tftp.c b/net/tftp.c
index 8e6df0a..42469e7 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -55,8 +55,8 @@ enum {
 	TFTP_ERR_FILE_ALREADY_EXISTS = 6,
 };
 
-static IPaddr_t TftpServerIP;
-static int	TftpServerPort;		/* The UDP port at their end		*/
+static IPaddr_t TftpRemoteIP;
+static int	TftpRemotePort;		/* The UDP port at their end		*/
 static int	TftpOurPort;		/* The UDP port at our end		*/
 static int	TftpTimeoutCount;
 static ulong	TftpBlock;		/* packet sequence number		*/
@@ -273,7 +273,8 @@ TftpSend (void)
 		break;
 	}
 
-	NetSendUDPPacket(NetServerEther, TftpServerIP, TftpServerPort, TftpOurPort, len);
+	NetSendUDPPacket(NetServerEther, TftpRemoteIP, TftpRemotePort,
+			 TftpOurPort, len);
 }
 
 
@@ -292,9 +293,8 @@ TftpHandler (uchar * pkt, unsigned dest, IPaddr_t sip, unsigned src,
 #endif
 		return;
 	}
-	if (TftpState != STATE_RRQ && src != TftpServerPort) {
+	if (TftpState != STATE_RRQ && src != TftpRemotePort)
 		return;
-	}
 
 	if (len < 2) {
 		return;
@@ -318,7 +318,7 @@ TftpHandler (uchar * pkt, unsigned dest, IPaddr_t sip, unsigned src,
 			pkt,
 			pkt + strlen((char *)pkt) + 1);
 		TftpState = STATE_OACK;
-		TftpServerPort = src;
+		TftpRemotePort = src;
 		/*
 		 * Check for 'blksize' option.
 		 * Careful: "i" is signed, "len" is unsigned, thus
@@ -386,7 +386,7 @@ TftpHandler (uchar * pkt, unsigned dest, IPaddr_t sip, unsigned src,
 		if (TftpState == STATE_RRQ || TftpState == STATE_OACK) {
 			/* first block received */
 			TftpState = STATE_DATA;
-			TftpServerPort = src;
+			TftpRemotePort = src;
 			TftpLastBlock = 0;
 			TftpBlockWrap = 0;
 			TftpBlockWrapOffset = 0;
@@ -421,7 +421,7 @@ TftpHandler (uchar * pkt, unsigned dest, IPaddr_t sip, unsigned src,
 
 		/*
 		 *	Acknoledge the block just received, which will prompt
-		 *	the server for the next one.
+		 *	the remote for the next one.
 		 */
 #ifdef CONFIG_MCAST_TFTP
 		/* if I am the MasterClient, actively calculate what my next
@@ -548,7 +548,7 @@ TftpStart (void)
 	debug("TFTP blocksize = %i, timeout = %ld ms\n",
 		TftpBlkSizeOption, TftpTimeoutMSecs);
 
-	TftpServerIP = NetServerIP;
+	TftpRemoteIP = NetServerIP;
 	if (BootFile[0] == '\0') {
 		sprintf(default_filename, "%02lX%02lX%02lX%02lX.img",
 			NetOurIP & 0xFF,
@@ -568,7 +568,7 @@ TftpStart (void)
 			strncpy(tftp_filename, BootFile, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		} else {
-			TftpServerIP = string_to_ip (BootFile);
+			TftpRemoteIP = string_to_ip(BootFile);
 			strncpy(tftp_filename, p + 1, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		}
@@ -578,12 +578,12 @@ TftpStart (void)
 	printf ("Using %s device\n", eth_get_name());
 #endif
 	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 */
 	if (NetOurGatewayIP && NetOurSubnetMask) {
 	    IPaddr_t OurNet	= NetOurIP    & NetOurSubnetMask;
-	    IPaddr_t ServerNet	= TftpServerIP & NetOurSubnetMask;
+	    IPaddr_t ServerNet	= TftpRemoteIP & NetOurSubnetMask;
 
 	    if (OurNet != ServerNet)
 		printf("; sending through gateway %pI4", &NetOurGatewayIP);
@@ -608,7 +608,7 @@ TftpStart (void)
 	NetSetTimeout (TftpTimeoutMSecs, TftpTimeout);
 	NetSetHandler (TftpHandler);
 
-	TftpServerPort = WELL_KNOWN_PORT;
+	TftpRemotePort = WELL_KNOWN_PORT;
 	TftpTimeoutCount = 0;
 	TftpState = STATE_RRQ;
 	/* Use a pseudo-random port unless a specific port is set */
@@ -616,7 +616,7 @@ TftpStart (void)
 
 #ifdef CONFIG_TFTP_PORT
 	if ((ep = getenv("tftpdstp")) != NULL) {
-		TftpServerPort = simple_strtol(ep, NULL, 10);
+		TftpRemotePort = simple_strtol(ep, NULL, 10);
 	}
 	if ((ep = getenv("tftpsrcp")) != NULL) {
 		TftpOurPort= simple_strtol(ep, NULL, 10);
-- 
1.7.1

  parent reply	other threads:[~2011-04-14 15:52 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13  9:08 [U-Boot] [RFC] Act as a TFTP server Luca Ceresoli
2011-04-13 11:37 ` Wolfgang Denk
2011-04-13 12:47   ` Luca Ceresoli
2011-04-30 19:53     ` Wolfgang Denk
2011-05-03 12:23       ` Luca Ceresoli
2011-05-03 12:36         ` Wolfgang Denk
2011-05-16 20:57           ` Luca Ceresoli
2011-04-14 10:31 ` Luca Ceresoli
2011-04-14 15:52 ` [U-Boot] [PATCH 0/6] " Luca Ceresoli
2011-04-14 16:13   ` Albert ARIBAUD
2011-04-18 16:19   ` [U-Boot] [PATCH v2 " Luca Ceresoli
2011-04-19 14:05     ` Detlev Zundel
2011-05-17 10:03     ` [U-Boot] [PATCH v3 0/5] " Luca Ceresoli
2011-05-17 10:03     ` [U-Boot] [PATCH v3 1/5] TFTP: replace "server" with "remote" in local variable names Luca Ceresoli
2011-05-19  8:11       ` Detlev Zundel
2011-05-19 19:39       ` Wolfgang Denk
2011-05-17 10:03     ` [U-Boot] [PATCH v3 2/5] TFTP: rename STATE_RRQ to STATE_SEND_RRQ Luca Ceresoli
2011-05-19  8:12       ` Detlev Zundel
2011-05-19 19:39       ` Wolfgang Denk
2011-05-17 10:03     ` [U-Boot] [PATCH v3 3/5] TFTP: net/tftp.c: add server mode receive Luca Ceresoli
2011-05-19  8:13       ` Detlev Zundel
2011-05-19 19:48       ` Wolfgang Denk
2011-05-17 10:03     ` [U-Boot] [PATCH v3 4/5] TFTP: add tftpsrv command Luca Ceresoli
2011-05-19  8:12       ` Detlev Zundel
2011-05-19 19:48       ` Wolfgang Denk
2011-05-17 10:03     ` [U-Boot] [PATCH v3 5/5] net/tftp.c: fix typo Luca Ceresoli
2011-05-19  8:13       ` Detlev Zundel
2011-05-19 19:48       ` Wolfgang Denk
2011-04-18 16:19   ` [U-Boot] [PATCH v2 1/6] README: remove spurious line Luca Ceresoli
2011-04-19 14:07     ` Detlev Zundel
2011-04-18 16:19   ` [U-Boot] [PATCH v2 2/6] NET: pass source IP address to packet handlers Luca Ceresoli
2011-04-19 14:15     ` Detlev Zundel
2011-04-19 15:26       ` Luca Ceresoli
2011-05-12 17:38     ` Wolfgang Denk
2011-04-18 16:19   ` [U-Boot] [PATCH v2 3/6] TFTP: rename "server" to "remote" Luca Ceresoli
2011-04-19 14:18     ` Detlev Zundel
2011-04-19 15:29       ` Luca Ceresoli
2011-04-19 16:28         ` Detlev Zundel
2011-04-19 21:56           ` Luca Ceresoli
2011-04-20  8:17             ` Detlev Zundel
2011-05-04  7:58               ` Luca Ceresoli
2011-05-04 10:37                 ` Detlev Zundel
2011-04-20  8:41         ` Detlev Zundel
2011-04-20 10:55           ` Luca Ceresoli
2011-04-20 13:27             ` [U-Boot] checkpatch - theory and practice [was: [PATCH v2 3/6] TFTP: rename "server" to "remote"] Detlev Zundel
2011-05-16 20:35         ` [U-Boot] [PATCH v2 3/6] TFTP: rename "server" to "remote" Luca Ceresoli
2011-05-17  9:38           ` Detlev Zundel
2011-04-30  4:36     ` Mike Frysinger
2011-05-16 20:16       ` Luca Ceresoli
2011-05-12 17:46     ` Wolfgang Denk
2011-05-13  7:36       ` Luca Ceresoli
2011-05-14 16:07         ` Luca Ceresoli
2011-04-18 16:19   ` [U-Boot] [PATCH v2 4/6] TFTP: rename STATE_RRQ to STATE_SEND_RRQ Luca Ceresoli
2011-04-19 14:22     ` Detlev Zundel
2011-04-18 16:19   ` [U-Boot] [PATCH v2 5/6] TFTP: net/tftp.c: add server mode receive Luca Ceresoli
2011-04-19 14:37     ` Detlev Zundel
2011-05-17  8:06       ` Luca Ceresoli
2011-05-17  9:41         ` Detlev Zundel
2011-04-18 16:19   ` [U-Boot] [PATCH v2 6/6] TFTP: add tftpsrv command Luca Ceresoli
2011-04-19 14:39     ` Detlev Zundel
2011-04-30  4:32     ` Mike Frysinger
2011-05-04  7:02     ` Mike Frysinger
2011-04-14 15:52 ` [U-Boot] [PATCH 1/6] README: remove spurious line Luca Ceresoli
2011-04-30 20:19   ` Wolfgang Denk
2011-04-14 15:52 ` [U-Boot] [PATCH 2/6] NET: pass source IP address to packet handlers Luca Ceresoli
2011-04-30 20:22   ` Wolfgang Denk
2011-04-30 20:24   ` Wolfgang Denk
2011-05-03  8:54     ` Luca Ceresoli
2011-04-14 15:52 ` Luca Ceresoli [this message]
2011-04-14 15:52 ` [U-Boot] [PATCH 4/6] TFTP: rename STATE_RRQ to STATE_SEND_RRQ Luca Ceresoli
2011-04-14 15:52 ` [U-Boot] [PATCH 5/6] TFTP: net/tftp.c: add server mode receive Luca Ceresoli
2011-04-14 15:52 ` [U-Boot] [PATCH 6/6] TFTP: add tftpsrv command Luca Ceresoli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302796377-3321-4-git-send-email-luca.ceresoli@comelit.it \
    --to=luca.ceresoli@comelit.it \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.