Lines Matching +full:re +full:- +full:sending

4  * SPDX-License-Identifier: Apache-2.0
47 return ptr - (char *)buf; in make_request()
72 sys_put_be16(DATA_OPCODE, client->tftp_buf); in send_data()
73 sys_put_be16(block_no, client->tftp_buf + 2); in send_data()
74 memcpy(client->tftp_buf + TFTP_HEADER_SIZE, data_buffer, data_size); in send_data()
76 ret = zsock_send(sock, client->tftp_buf, data_size + TFTP_HEADER_SIZE, 0); in send_data()
78 LOG_ERR("send() error: %d", -errno); in send_data()
79 return -errno; in send_data()
90 LOG_ERR("recv() error: %d", -errno); in send_data()
91 return -errno; /* IO error */ in send_data()
93 break; /* no response, re-send data */ in send_data()
96 ret = zsock_recv(sock, client->tftp_buf, TFTPC_MAX_BUF_SIZE, 0); in send_data()
98 LOG_ERR("recv() error: %d", -errno); in send_data()
99 return -errno; in send_data()
103 break; /* wrong response, re-send data */ in send_data()
106 uint16_t opcode = sys_get_be16(client->tftp_buf); in send_data()
107 uint16_t blockno = sys_get_be16(client->tftp_buf + 2); in send_data()
119 if (client->callback) { in send_data()
124 evt.param.error.msg = client->tftp_buf + TFTP_HEADER_SIZE; in send_data()
126 client->callback(&evt); in send_data()
132 break; /* wrong response, re-send data */ in send_data()
149 LOG_DBG("Client sending error code: %d", err_code); in send_err()
152 sys_put_be16(ERROR_OPCODE, client->tftp_buf); in send_err()
153 sys_put_be16(err_code, client->tftp_buf + 2); in send_err()
160 if (copy_len > sizeof(client->tftp_buf) - req_size) { in send_err()
161 copy_len = sizeof(client->tftp_buf) - req_size; in send_err()
164 memcpy(client->tftp_buf + req_size, err_msg, copy_len); in send_err()
169 return zsock_send(sock, client->tftp_buf, req_size, 0); in send_err()
177 LOG_DBG("Client acking block number: %d", ntohs(ackhdr->block)); in send_ack()
190 req_size = make_request(client->tftp_buf, request, remote_file, mode); in send_request()
195 LOG_DBG("Sending TFTP request %d file %s", request, in send_request()
199 ret = zsock_sendto(sock, client->tftp_buf, req_size, 0, &client->server, in send_request()
200 ADDRLEN(client->server)); in send_request()
222 ret = zsock_recvfrom(sock, client->tftp_buf, TFTPC_MAX_BUF_SIZE, 0, in send_request()
225 req_size = make_request(client->tftp_buf, request, in send_request()
232 ret = -errno; in send_request()
258 return -EINVAL; in tftp_get()
261 sock = zsock_socket(client->server.sa_family, SOCK_DGRAM, IPPROTO_UDP); in tftp_get()
264 return -errno; in tftp_get()
273 uint16_t opcode = sys_get_be16(client->tftp_buf); in tftp_get()
274 uint16_t block_no = sys_get_be16(client->tftp_buf + 2); in tftp_get()
280 if (client->callback) { in tftp_get()
285 evt.param.error.msg = client->tftp_buf + TFTP_HEADER_SIZE; in tftp_get()
287 client->callback(&evt); in tftp_get()
298 uint32_t data_size = rcv_size - TFTP_HEADER_SIZE; in tftp_get()
304 if (client->callback == NULL) { in tftp_get()
308 -errno); in tftp_get()
319 evt.param.data.data_ptr = client->tftp_buf + TFTP_HEADER_SIZE; in tftp_get()
321 client->callback(&evt); in tftp_get()
334 * terminate its side of the connection on sending the final ACK. in tftp_get()
359 ret = zsock_recv(sock, client->tftp_buf, TFTPC_MAX_BUF_SIZE, 0); in tftp_get()
383 return -EINVAL; in tftp_put()
386 sock = zsock_socket(client->server.sa_family, SOCK_DGRAM, IPPROTO_UDP); in tftp_put()
389 return -errno; in tftp_put()
397 uint16_t opcode = sys_get_be16(client->tftp_buf); in tftp_put()
398 uint16_t block_no = sys_get_be16(client->tftp_buf + 2); in tftp_put()
403 if (client->callback) { in tftp_put()
408 evt.param.error.msg = client->tftp_buf + TFTP_HEADER_SIZE; in tftp_put()
410 client->callback(&evt); in tftp_put()
427 send_size = user_buf_size - tftpc_index; in tftp_put()