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.

andns_net.h 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**************************************
  2. * AUTHOR: Federico Tomassini *
  3. * Copyright (C) Federico Tomassini *
  4. * Contact effetom@gmail.com *
  5. ***********************************************
  6. ******* BEGIN 4/2006 ********
  7. *************************************************************************
  8. * *
  9. * This program is free software; you can redistribute it and/or modify *
  10. * it under the terms of the GNU General Public License as published by *
  11. * the Free Software Foundation; either version 2 of the License, or *
  12. * (at your option) any later version. *
  13. * *
  14. * This program is distributed in the hope that it will be useful, *
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  17. * GNU General Public License for more details. *
  18. * *
  19. ************************************************************************/
  20. #ifndef ANDNS_NET_H
  21. #define ANDNS_NET_H
  22. #include <errno.h>
  23. #include <netdb.h>
  24. #include <unistd.h>
  25. #include <stdio.h>
  26. #include <string.h>
  27. #include <sys/types.h>
  28. #include <sys/socket.h>
  29. #include <arpa/inet.h>
  30. int idp_inet_ntop(int family, struct sockaddr *addr, char *buf,
  31. int buflen);
  32. int w_socket(int family, int type, int proto, int die);
  33. int w_connect(struct addrinfo *ai, int die);
  34. int serial_connect(struct addrinfo *ai, int die);
  35. int host_connect(const char *host, uint16_t port, int type, int die);
  36. int ai_connect(struct addrinfo *ai, int die, int free_ai);
  37. ssize_t w_send(int sk, const void *buf, size_t len, int die);
  38. ssize_t w_recv(int sk, void *buf, size_t len, int die);
  39. ssize_t w_send_timeout(int s, const void *buf, size_t len, int die,
  40. int timeout);
  41. ssize_t w_recv_timeout(int s, void *buf, size_t len, int die, int timeout);
  42. ssize_t ai_send_recv_close(struct addrinfo *ai, void *buf, size_t buflen,
  43. void *anbuf, size_t anlen, int die, int free_ai,
  44. int timeout);
  45. ssize_t hn_send_recv_close(const char *host, uint16_t port, int type,
  46. void *buf, size_t buflen, void *anbuf,
  47. size_t anlen, int die, int timeout);
  48. void char_print(char *buf, int len);
  49. #endif /* ANDNS_NET_H */