• Home
  • Raw
  • Download

Lines Matching refs:tp

53 static int tftp_session_allocate(struct tftp_t *tp)  in tftp_session_allocate()  argument
73 spt->client_ip = ip_geth(tp->ip.ip_src); in tftp_session_allocate()
74 spt->client_port = port_geth(tp->udp.uh_sport); in tftp_session_allocate()
81 static int tftp_session_find(struct tftp_t *tp) in tftp_session_find() argument
90 if (spt->client_ip == ip_geth(tp->ip.ip_src)) { in tftp_session_find()
91 if (spt->client_port == port_geth(tp->udp.uh_sport)) { in tftp_session_find()
137 struct tftp_t *tp; in tftp_send_oack() local
148 tp = (void *)m->m_data; in tftp_send_oack()
151 tp->tp_op = htons(TFTP_OACK); in tftp_send_oack()
152 n += snprintf((char *)tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%s", in tftp_send_oack()
154 n += snprintf((char *)tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%u", in tftp_send_oack()
180 struct tftp_t *tp; in tftp_send_error() local
191 tp = (void *)m->m_data; in tftp_send_error()
194 tp->tp_op = htons(TFTP_ERROR); in tftp_send_error()
195 tp->x.tp_error.tp_error_code = htons(errorcode); in tftp_send_error()
196 pstrcpy((char *)tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg); in tftp_send_error()
222 struct tftp_t *tp; in tftp_send_data() local
238 tp = (void *)m->m_data; in tftp_send_data()
241 tp->tp_op = htons(TFTP_DATA); in tftp_send_data()
242 tp->x.tp_data.tp_block_nr = htons(block_nr); in tftp_send_data()
252 nobytes = tftp_read_data(spt, block_nr - 1, tp->x.tp_data.tp_buf, 512); in tftp_send_data()
259 tftp_send_error(spt, 1, "File not found", tp); in tftp_send_data()
279 static void tftp_handle_rrq(struct tftp_t *tp, int pktlen) in tftp_handle_rrq() argument
285 s = tftp_session_allocate(tp); in tftp_handle_rrq()
293 src = tp->x.tp_buf; in tftp_handle_rrq()
295 n = pktlen - ((uint8_t *)&tp->x.tp_buf[0] - (uint8_t *)tp); in tftp_handle_rrq()
324 tftp_send_error(spt, 4, "Unsupported transfer mode", tp); in tftp_handle_rrq()
335 tftp_send_error(spt, 2, "Access violation", tp); in tftp_handle_rrq()
342 tftp_send_error(spt, 2, "Access violation", tp); in tftp_handle_rrq()
349 tftp_send_error(spt, 1, "File not found", tp); in tftp_handle_rrq()
354 tftp_send_error(spt, 2, "Access violation", tp); in tftp_handle_rrq()
365 tftp_send_error(spt, 2, "Access violation", tp); in tftp_handle_rrq()
385 tftp_send_error(spt, 1, "File not found", tp); in tftp_handle_rrq()
390 tftp_send_oack(spt, "tsize", tsize, tp); in tftp_handle_rrq()
394 tftp_send_data(spt, 1, tp); in tftp_handle_rrq()
397 static void tftp_handle_ack(struct tftp_t *tp, int pktlen) in tftp_handle_ack() argument
401 s = tftp_session_find(tp); in tftp_handle_ack()
408 ntohs(tp->x.tp_data.tp_block_nr) + 1, in tftp_handle_ack()
409 tp) < 0) { in tftp_handle_ack()
416 struct tftp_t *tp = (struct tftp_t *)m->m_data; in tftp_input() local
418 switch(ntohs(tp->tp_op)) { in tftp_input()
420 tftp_handle_rrq(tp, m->m_len); in tftp_input()
424 tftp_handle_ack(tp, m->m_len); in tftp_input()