Thanks, will do. On Wed, 6 Nov 2019 at 01:51, Santiago Gimeno <santiago.gim...@gmail.com> wrote: > > Hi Iñaki, > > I don't think there is a way right now though I think it might be implemented > by extending the uv_udp_send_t structure to hold a "before_send" cb so you > can set the option, which in turn could bet unset in the send_cb. (extending > the uv_udp_send_t might be possible by using one entry in the reserved field > of the uv_req). Of course, this is just an idea which could be bad or simply > wrong. I would open an issue in the libuv repo to discuss your use case and > possible solutions. > > Cheers, > > Santi > > El mar., 5 nov. 2019 a las 6:18, Iñaki Baz Castillo (<i...@aliax.net>) > escribió: >> >> Hi, just wondering how to deal with this scenario in which I need to >> set different DSCP values to UDP packets (actually IP packets) sent on >> the same uv_udp_t handle. >> >> For instance, I send RTP audio and video packets and need to set a >> specific DSCP/ToS value **just** for audio packets: >> >> pseudo-code: >> ------------------------------------------------- >> int tos = 0x60; // CS3 just for audio packets. >> uv_os_fd_t fd; >> >> // Get the real file descriptor from our libuv UDP handle: >> uv_fileno((const uv_handle_t*)udpHandle, &fd); >> >> // Set ToS/DSCP: >> if (setsockopt(sock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) { >> fprintf(stderr,"Error setting TOS: %s\n", strerror(errno)); >> } >> >> // Try to send the packet synchronously: >> uv_udp_try_send(....); >> >> // It fails, so send it asynchronously: >> uv_udp_send(....); >> -------------------------------------------------- >> >> This is: before sending each packet I need to call setsockopt() with >> the corresponding DSCP/ToS value for that packet. However, since I may >> need to use uv_udp_send() it may happen that, when libuv finally sends >> the RTP audio packet, the socket DSCP setting may has been modified >> again due to a new call to setsockopt() for a different packet to be >> sent. >> >> Just wondering if there is a way to tell libuv "please send this >> socket option for sending this data no matter when such a data is >> actually sent. >> >> Thanks a lot. >> >> >> -- >> Iñaki Baz Castillo >> <i...@aliax.net> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "libuv" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to libuv+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/libuv/CALiegfmopAxJ1q-dPnB0zOk%3Dx0q_78U3VVpqZ%2BnDaNq0xoAmrw%40mail.gmail.com. > > -- > You received this message because you are subscribed to the Google Groups > "libuv" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to libuv+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/libuv/CAAJY-XMQWUuCifhqy0evsN3hHhcDrRvMe4cM%2BQhVSmpOsB3Oxw%40mail.gmail.com.
-- Iñaki Baz Castillo <i...@aliax.net> -- You received this message because you are subscribed to the Google Groups "libuv" group. To unsubscribe from this group and stop receiving emails from it, send an email to libuv+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/libuv/CALiegfnCSmB9AJQ%3DeWs_LaA1_s%3DH1BfQjBjHqMaiyRA%3DsMz-SA%40mail.gmail.com.