Home | History | Annotate | Download | only in slirp-android

Lines Matching refs:tp

53 static int tftp_session_allocate(struct tftp_t *tp)
73 spt->client_ip = ip_geth(tp->ip.ip_src);
74 spt->client_port = port_geth(tp->udp.uh_sport);
81 static int tftp_session_find(struct tftp_t *tp)
90 if (spt->client_ip == ip_geth(tp->ip.ip_src)) {
91 if (spt->client_port == port_geth(tp->udp.uh_sport)) {
137 struct tftp_t *tp;
148 tp = (void *)m->m_data;
151 tp->tp_op = htons(TFTP_OACK);
152 n += snprintf((char *)tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%s",
154 n += snprintf((char *)tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%u",
180 struct tftp_t *tp;
192 tp = (void *)m->m_data;
195 tp->tp_op = htons(TFTP_ERROR);
196 tp->x.tp_error.tp_error_code = htons(errorcode);
197 pstrcpy((char *)tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg);
225 struct tftp_t *tp;
241 tp = (void *)m->m_data;
244 tp->tp_op = htons(TFTP_DATA);
245 tp->x.tp_data.tp_block_nr = htons(block_nr);
255 nobytes = tftp_read_data(spt, block_nr - 1, tp->x.tp_data.tp_buf, 512);
262 tftp_send_error(spt, 1, "File not found", tp);
282 static void tftp_handle_rrq(struct tftp_t *tp, int pktlen)
288 s = tftp_session_allocate(tp);
296 src = tp->x.tp_buf;
298 n = pktlen - ((uint8_t *)&tp->x.tp_buf[0] - (uint8_t *)tp);
327 tftp_send_error(spt, 4, "Unsupported transfer mode", tp);
338 tftp_send_error(spt, 2, "Access violation", tp);
345 tftp_send_error(spt, 2, "Access violation", tp);
352 tftp_send_error(spt, 1, "File not found", tp);
357 tftp_send_error(spt, 2, "Access violation", tp);
368 tftp_send_error(spt, 2, "Access violation", tp);
389 tftp_send_error(spt, 1, "File not found", tp);
394 tftp_send_oack(spt, "tsize", tsize, tp);
398 tftp_send_data(spt, 1, tp);
401 static void tftp_handle_ack(struct tftp_t *tp, int pktlen)
405 s = tftp_session_find(tp);
412 ntohs(tp->x.tp_data.tp_block_nr) + 1,
413 tp) < 0) {
420 struct tftp_t *tp = (struct tftp_t *)m->m_data;
422 switch(ntohs(tp->tp_op)) {
424 tftp_handle_rrq(tp, m->m_len);
428 tftp_handle_ack(tp, m->m_len);