Lines Matching +full:- +full:- +full:retry
1 /* tftp.c - TFTP client.
18 -l FILE Local FILE
19 -r FILE Remote FILE
20 -g Get file
21 -p Put file
22 -b SIZE Transfer blocks of SIZE octets(8 <= SIZE <= 65464)
41 #define TFTP_DATASIZE (TFTP_PACKETSIZE-TFTP_DATAHEADERSIZE)
77 ((struct sockaddr_in6 *)server)->sin6_family = AF_INET6;
78 ((struct sockaddr_in6 *)server)->sin6_addr =
79 ((struct sockaddr_in6 *)&TT.inaddr)->sin6_addr;
80 ((struct sockaddr_in6 *)server)->sin6_port = htons(port);
83 ((struct sockaddr_in *)server)->sin_family = AF_INET;
84 ((struct sockaddr_in *)server)->sin_addr.s_addr =
85 ((struct sockaddr_in *)&TT.inaddr)->sin_addr.s_addr;
86 ((struct sockaddr_in *)server)->sin_port = htons(port);
189 return -1; in check_data()
203 if (tmp == (off_t) -1) { in mkpkt_data()
205 return -1; in mkpkt_data()
208 if (nbytesread < 0) return -1; in mkpkt_data()
219 int packetlen, retry; in read_ack() local
221 for (retry = 0; retry < TFTP_RETRIES; retry++) { in read_ack()
231 *port = ((struct sockaddr_in *)&from)->sin_port; in read_ack()
232 ((struct sockaddr_in *)server)->sin_port = in read_ack()
233 ((struct sockaddr_in *)&from)->sin_port; in read_ack()
235 if (((struct sockaddr_in *)server)->sin_addr.s_addr != in read_ack()
236 ((struct sockaddr_in *)&from)->sin_addr.s_addr) { in read_ack()
240 if (*port != ((struct sockaddr_in *)server)->sin_port) { in read_ack()
263 return -1; in read_ack()
272 int len, sd, fd, retry, nbytesrecvd = 0, ndatabytes, ret, result = -1; in file_get() local
285 if (TT.af == AF_INET6) ((struct sockaddr_in6 *)&server)->sin6_port = 0; in file_get()
286 else ((struct sockaddr_in *)&server)->sin_port = 0; in file_get()
290 for (retry = 0 ; retry < TFTP_RETRIES; retry++) { in file_get()
294 memcmp(&((struct sockaddr_in *)&server)->sin_addr, in file_get()
295 &((struct sockaddr_in *)&from)->sin_addr, in file_get()
298 memcmp(&((struct sockaddr_in6 *)&server)->sin6_addr, in file_get()
299 &((struct sockaddr_in6 *)&from)->sin6_addr, in file_get()
302 retry--; in file_get()
305 if ( ((TT.af == AF_INET) && ((struct sockaddr_in *)&server)->sin_port in file_get()
306 && (((struct sockaddr_in *)&server)->sin_port != in file_get()
307 ((struct sockaddr_in *)&from)->sin_port)) || in file_get()
308 ((TT.af == AF_INET6) && ((struct sockaddr_in6 *)&server)->sin6_port in file_get()
309 && (((struct sockaddr_in6 *)&server)->sin6_port != in file_get()
310 ((struct sockaddr_in6 *)&from)->sin6_port))) { in file_get()
314 retry--; in file_get()
330 if (rblockno && (rblockno < 9)) message = arr[rblockno - 1]; in file_get()
347 if ((TT.af == AF_INET6) && !((struct sockaddr_in6 *)&server)->sin6_port) in file_get()
348 ((struct sockaddr_in6 *)&server)->sin6_port = in file_get()
349 ((struct sockaddr_in6 *)&from)->sin6_port; in file_get()
350 else if ((TT.af == AF_INET) && !((struct sockaddr_in *)&server)->sin_port) in file_get()
351 ((struct sockaddr_in *)&server)->sin_port = in file_get()
352 ((struct sockaddr_in *)&from)->sin_port; in file_get()
356 if (retry == TFTP_RETRIES) { in file_get()
357 error_msg("Retry limit exceeded."); in file_get()
361 ndatabytes = nbytesrecvd - TFTP_DATAHEADERSIZE; in file_get()
388 int packetlen, sd, fd, retry = 0, ret, result = -1; in file_put() local
399 if (++retry > TFTP_RETRIES) { in file_put()
400 error_msg("Retry count exceeded."); in file_put()
416 retry = 0; in file_put()
420 if (++retry > TFTP_RETRIES) { in file_put()
421 error_msg("Retry count exceeded."); in file_put()
450 for (res = info; res; res = res->ai_next) in tftp_main()
451 if ( (res->ai_family == AF_INET) || (res->ai_family == AF_INET6)) break; in tftp_main()
455 TT.af = info->ai_family; in tftp_main()
457 memcpy((void *)&TT.inaddr, info->ai_addr, info->ai_addrlen); in tftp_main()