@@ -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,16 @@ 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 = { conn , status };
150
157
158
+ process_post_synch (conn -> appstate .p , tcpip_udp_sent_event , & data );
159
+ }
160
+ /*---------------------------------------------------------------------------*/
151
161
#if UIP_CONF_IP_FORWARD
152
162
unsigned char tcpip_is_forwarding ; /* Forwarding right now? */
153
163
#endif /* UIP_CONF_IP_FORWARD */
@@ -321,6 +331,8 @@ udp_new(const uip_ipaddr_t *ripaddr, uint16_t port, void *appstate)
321
331
s = & c -> appstate ;
322
332
s -> p = PROCESS_CURRENT ();
323
333
s -> state = appstate ;
334
+ s -> sent .ptr = c ;
335
+ s -> sent .callback = tcpip_udp_sent_callback ;
324
336
325
337
return c ;
326
338
}
@@ -537,7 +549,7 @@ tcpip_input(void)
537
549
/*---------------------------------------------------------------------------*/
538
550
#if NETSTACK_CONF_WITH_IPV6
539
551
void
540
- tcpip_ipv6_output ( void )
552
+ tcpip_ipv6_output_sent ( struct tcpip_sent * sent )
541
553
{
542
554
uip_ds6_nbr_t * nbr = NULL ;
543
555
uip_ipaddr_t * nexthop ;
@@ -702,7 +714,7 @@ tcpip_ipv6_output(void)
702
714
}
703
715
#endif /* UIP_ND6_SEND_NA */
704
716
705
- tcpip_output (uip_ds6_nbr_get_ll (nbr ));
717
+ tcpip_output_sent (uip_ds6_nbr_get_ll (nbr ), sent );
706
718
707
719
#if UIP_CONF_IPV6_QUEUE_PKT
708
720
/*
@@ -715,7 +727,7 @@ tcpip_ipv6_output(void)
715
727
uip_len = uip_packetqueue_buflen (& nbr -> packethandle );
716
728
memcpy (UIP_IP_BUF , uip_packetqueue_buf (& nbr -> packethandle ), uip_len );
717
729
uip_packetqueue_free (& nbr -> packethandle );
718
- tcpip_output (uip_ds6_nbr_get_ll (nbr ));
730
+ tcpip_output_sent (uip_ds6_nbr_get_ll (nbr ), sent );
719
731
}
720
732
#endif /*UIP_CONF_IPV6_QUEUE_PKT*/
721
733
@@ -725,7 +737,7 @@ tcpip_ipv6_output(void)
725
737
return ;
726
738
}
727
739
/* Multicast IP destination address. */
728
- tcpip_output (NULL );
740
+ tcpip_output_sent (NULL , sent );
729
741
uip_len = 0 ;
730
742
uip_ext_len = 0 ;
731
743
}
@@ -808,6 +820,8 @@ PROCESS_THREAD(tcpip_process, ev, data)
808
820
#endif
809
821
810
822
tcpip_event = process_alloc_event ();
823
+ tcpip_udp_sent_event = process_alloc_event ();
824
+
811
825
#if UIP_CONF_ICMP6
812
826
tcpip_icmp6_event = process_alloc_event ();
813
827
#endif /* UIP_CONF_ICMP6 */
0 commit comments