1
0

util.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 _UTIL_H_
  27. #define _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 //_UTIL_H_