local.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. Copyright (c) 2008 by Juliusz Chroboczek
  3. Permission is hereby granted, free of charge, to any person obtaining a copy
  4. of this software and associated documentation files (the "Software"), to deal
  5. in the Software without restriction, including without limitation the rights
  6. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. copies of the Software, and to permit persons to whom the Software is
  8. furnished to do so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in
  10. all copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. THE SOFTWARE.
  18. */
  19. struct neighbour;
  20. struct babel_route;
  21. struct xroute;
  22. #define LOCAL_FLUSH 0
  23. #define LOCAL_ADD 1
  24. #define LOCAL_CHANGE 2
  25. #ifndef MAX_LOCAL_SOCKETS
  26. #define MAX_LOCAL_SOCKETS 4
  27. #endif
  28. #define LOCAL_BUFSIZE 1024
  29. struct local_socket {
  30. int fd;
  31. char *buf;
  32. int n;
  33. int monitor;
  34. };
  35. extern int local_server_socket;
  36. extern struct local_socket local_sockets[MAX_LOCAL_SOCKETS];
  37. extern int num_local_sockets;
  38. extern int local_server_port;
  39. extern char *local_server_path;
  40. void local_notify_interface(struct interface *ifp, int kind);
  41. void local_notify_neighbour(struct neighbour *neigh, int kind);
  42. void local_notify_xroute(struct xroute *xroute, int kind);
  43. void local_notify_route(struct babel_route *route, int kind);
  44. int local_read(struct local_socket *s);
  45. int local_header(struct local_socket *s);
  46. struct local_socket *local_socket_create(int fd);
  47. void local_socket_destroy(int i);