You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

daemon.h 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* This file is part of Netsukuku
  2. * (c) Copyright 2004 Andrea Lo Pumo aka AlpT <alpt@freaknet.org>
  3. *
  4. * This source code is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as published
  6. * by the Free Software Foundation; either version 2 of the License,
  7. * or (at your option) any later version.
  8. *
  9. * This source code is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. * Please refer to the GNU Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Public License along with
  15. * this source code; if not, write to:
  16. * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18. #ifndef DAEMON_H
  19. #define DAEMON_H
  20. #define MAX_LISTENING_SOCKETS MAX_INTERFACES
  21. /* These mutexes are used to wait the complete start up of the daemons when
  22. * launched. */
  23. pthread_mutex_t udp_daemon_lock;
  24. pthread_mutex_t tcp_daemon_lock;
  25. /* flags for udp_exec_pkt_argv and udp_daemon_argv */
  26. #define UDP_THREAD_FOR_EACH_PKT 1 /* For each incoming udp
  27. packets use threads */
  28. /* Argv passed to udp_exec_pkt() */
  29. struct udp_exec_pkt_argv {
  30. PACKET *recv_pkt;
  31. int acpt_idx;
  32. int acpt_sidx;
  33. u_char flags;
  34. };
  35. /* Argv passed to udp_daemon */
  36. struct udp_daemon_argv {
  37. u_short port;
  38. u_char flags;
  39. };
  40. pthread_mutex_t udp_exec_lock;
  41. pthread_mutex_t tcp_exec_lock;
  42. int prepare_listen_socket(int family, int socktype, u_short port,
  43. interface * dev);
  44. void *tcp_recv_loop(void *recv_pkt);
  45. void *tcp_daemon(void *null);
  46. void *udp_daemon(void *door);
  47. #endif /*DAEMON_H */