UDPAddrIface.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* vim: set expandtab ts=4 sw=4: */
  2. /*
  3. * You may redistribute this program and/or modify it under the terms of
  4. * the GNU General Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. */
  15. #ifndef UDPAddrIface_H
  16. #define UDPAddrIface_H
  17. #include "exception/Err.h"
  18. #include "interface/addressable/AddrIface.h"
  19. #include "memory/Allocator.h"
  20. #include "util/Linker.h"
  21. Linker_require("util/events/libuv/UDPAddrIface.c")
  22. #include <stdbool.h>
  23. #define UDPAddrIface_PADDING_AMOUNT 512
  24. #define UDPAddrIface_BUFFER_CAP 3496
  25. /** Maximum number of bytes to hold in queue before dropping packets. */
  26. #define UDPAddrIface_MAX_QUEUE 16384
  27. struct UDPAddrIface
  28. {
  29. AddrIface_t generic;
  30. };
  31. /**
  32. * @param base the event loop context.
  33. * @param bindAddr the address/port to bind to.
  34. * @param allocator the memory allocator for this message.
  35. * @param logger
  36. * @return a new UDPInterfaceBase.
  37. */
  38. Err_DEFUN UDPAddrIface_new(
  39. struct UDPAddrIface** out,
  40. struct Sockaddr* addr,
  41. struct Allocator* alloc);
  42. int UDPAddrIface_setDSCP(struct UDPAddrIface* iface, uint8_t dscp);
  43. int UDPAddrIface_setBroadcast(struct UDPAddrIface* iface, bool enable);
  44. int UDPAddrIface_getFd(struct UDPAddrIface*);
  45. Err_DEFUN UDPAddrIface_workerStates(
  46. Object_t** out,
  47. struct UDPAddrIface* iface,
  48. Allocator_t* alloc);
  49. #endif