@@ -73,6 +73,7 @@ extern struct uip_fallback_interface UIP_FALLBACK_INTERFACE;
73
73
#endif
74
74
75
75
process_event_t tcpip_event ;
76
+ process_event_t tcpip_udp_sent_event ;
76
77
#if UIP_CONF_ICMP6
77
78
process_event_t tcpip_icmp6_event ;
78
79
#endif /* UIP_CONF_ICMP6 */
@@ -109,22 +110,22 @@ enum {
109
110
/* Called on IP packet output. */
110
111
#if NETSTACK_CONF_WITH_IPV6
111
112
112
- static uint8_t (* outputfunc )(const uip_lladdr_t * a );
113
+ static uint8_t (* outputfunc )(const uip_lladdr_t * a , struct tcpip_sent * sent );
113
114
114
115
uint8_t
115
- tcpip_output (const uip_lladdr_t * a )
116
+ tcpip_output_sent (const uip_lladdr_t * a , struct tcpip_sent * sent )
116
117
{
117
118
int ret ;
118
119
if (outputfunc != NULL ) {
119
- ret = outputfunc (a );
120
+ ret = outputfunc (a , sent );
120
121
return ret ;
121
122
}
122
123
UIP_LOG ("tcpip_output: Use tcpip_set_outputfunc() to set an output function" );
123
124
return 0 ;
124
125
}
125
126
126
127
void
127
- tcpip_set_outputfunc (uint8_t (* f )(const uip_lladdr_t * ))
128
+ tcpip_set_outputfunc (uint8_t (* f )(const uip_lladdr_t * , struct tcpip_sent * ))
128
129
{
129
130
outputfunc = f ;
130
131
}
@@ -147,7 +148,19 @@ tcpip_set_outputfunc(uint8_t (*f)(void))
147
148
outputfunc = f ;
148
149
}
149
150
#endif
151
+ /*---------------------------------------------------------------------------*/
152
+ static void
153
+ tcpip_udp_sent_callback (struct tcpip_sent * sent , int status )
154
+ {
155
+ struct uip_udp_conn * conn = sent -> ptr ;
156
+ struct tcpip_udp_sent_status data ;
157
+
158
+ data .conn = conn ;
159
+ data .status = status ;
150
160
161
+ process_post_synch (conn -> appstate .p , tcpip_udp_sent_event , & data );
162
+ }
163
+ /*---------------------------------------------------------------------------*/
151
164
#if UIP_CONF_IP_FORWARD
152
165
unsigned char tcpip_is_forwarding ; /* Forwarding right now? */
153
166
#endif /* UIP_CONF_IP_FORWARD */
@@ -321,6 +334,8 @@ udp_new(const uip_ipaddr_t *ripaddr, uint16_t port, void *appstate)
321
334
s = & c -> appstate ;
322
335
s -> p = PROCESS_CURRENT ();
323
336
s -> state = appstate ;
337
+ s -> sent .ptr = c ;
338
+ s -> sent .callback = tcpip_udp_sent_callback ;
324
339
325
340
return c ;
326
341
}
@@ -537,7 +552,7 @@ tcpip_input(void)
537
552
/*---------------------------------------------------------------------------*/
538
553
#if NETSTACK_CONF_WITH_IPV6
539
554
void
540
- tcpip_ipv6_output ( void )
555
+ tcpip_ipv6_output_sent ( struct tcpip_sent * sent )
541
556
{
542
557
uip_ds6_nbr_t * nbr = NULL ;
543
558
uip_ipaddr_t * nexthop ;
@@ -702,7 +717,7 @@ tcpip_ipv6_output(void)
702
717
}
703
718
#endif /* UIP_ND6_SEND_NA */
704
719
705
- tcpip_output (uip_ds6_nbr_get_ll (nbr ));
720
+ tcpip_output_sent (uip_ds6_nbr_get_ll (nbr ), sent );
706
721
707
722
#if UIP_CONF_IPV6_QUEUE_PKT
708
723
/*
@@ -715,7 +730,7 @@ tcpip_ipv6_output(void)
715
730
uip_len = uip_packetqueue_buflen (& nbr -> packethandle );
716
731
memcpy (UIP_IP_BUF , uip_packetqueue_buf (& nbr -> packethandle ), uip_len );
717
732
uip_packetqueue_free (& nbr -> packethandle );
718
- tcpip_output (uip_ds6_nbr_get_ll (nbr ));
733
+ tcpip_output_sent (uip_ds6_nbr_get_ll (nbr ), sent );
719
734
}
720
735
#endif /*UIP_CONF_IPV6_QUEUE_PKT*/
721
736
@@ -725,7 +740,7 @@ tcpip_ipv6_output(void)
725
740
return ;
726
741
}
727
742
/* Multicast IP destination address. */
728
- tcpip_output (NULL );
743
+ tcpip_output_sent (NULL , sent );
729
744
uip_len = 0 ;
730
745
uip_ext_len = 0 ;
731
746
}
@@ -808,6 +823,8 @@ PROCESS_THREAD(tcpip_process, ev, data)
808
823
#endif
809
824
810
825
tcpip_event = process_alloc_event ();
826
+ tcpip_udp_sent_event = process_alloc_event ();
827
+
811
828
#if UIP_CONF_ICMP6
812
829
tcpip_icmp6_event = process_alloc_event ();
813
830
#endif /* UIP_CONF_ICMP6 */
0 commit comments