1
0

util.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. ** JNetLib
  3. ** Copyright (C) 2000-2007 Nullsoft, Inc.
  4. ** Author: Justin Frankel
  5. ** File: util.h - JNL interface for basic network utilities
  6. ** License: see jnetlib.h
  7. **
  8. ** routines you may be interested in:
  9. ** JNL::open_socketlib();
  10. ** opens the socket library. Call this once before using any network
  11. ** code. If you create a new thread, call this again. Only really an
  12. ** issue for Win32 support, but use it anyway for portability/
  13. **
  14. ** JNL::close_Socketlib();
  15. ** closes the socketlib. Call this when you're done with the network,
  16. ** after all your JNetLib objects have been destroyed.
  17. **
  18. ** unsigned long JNL::ipstr_to_addr(const char *cp);
  19. ** gives you the integer representation of a ip address in dotted
  20. ** decimal form.
  21. **
  22. ** JNL::addr_to_ipstr(unsigned long addr, char *host, int maxhostlen);
  23. ** gives you the dotted decimal notation of an integer ip address.
  24. **
  25. */
  26. #ifndef NULLSOFT_WAC_NETWORK_UTIL_H
  27. #define NULLSOFT_WAC_NETWORK_UTIL_H
  28. class JNL
  29. {
  30. public:
  31. static int open_socketlib();
  32. static void close_socketlib();
  33. static unsigned long ipstr_to_addr( const char *cp );
  34. static void addr_to_ipstr( unsigned long addr, char *host, int maxhostlen );
  35. static int parse_url( const char *url, char **prot, char **host, unsigned short *port, char **req, char **lp );
  36. };
  37. #endif //!NULLSOFT_WAC_NETWORK_UTIL_H