Network.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // Network.h
  3. // ZeroTier One
  4. //
  5. // Created by Grant Limberg on 8/4/16.
  6. // Copyright © 2016 ZeroTier, Inc. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. enum NetworkStatus {
  10. REQUESTING_CONFIGURATION,
  11. OK,
  12. ACCESS_DENIED,
  13. NOT_FOUND,
  14. PORT_ERROR,
  15. CLIENT_TOO_OLD,
  16. };
  17. enum NetworkType {
  18. PUBLIC,
  19. PRIVATE,
  20. };
  21. @interface Network : NSObject <NSCoding>
  22. @property (readonly) NSArray<NSString*> *assignedAddresses;
  23. @property (readonly) BOOL bridge;
  24. @property (readonly) BOOL broadcastEnabled;
  25. @property (readonly) BOOL dhcp;
  26. @property (readonly) NSString *mac;
  27. @property (readonly) int mtu;
  28. @property (readonly) int netconfRevision;
  29. @property (readonly) NSString *name;
  30. @property (readonly) UInt64 nwid;
  31. @property (readonly) NSString *portDeviceName;
  32. @property (readonly) int portError;
  33. @property (readonly) enum NetworkStatus status;
  34. @property (readonly) enum NetworkType type;
  35. @property (readonly) BOOL allowManaged;
  36. @property (readonly) BOOL allowGlobal;
  37. @property (readonly) BOOL allowDefault;
  38. @property (readonly) BOOL connected; // not persisted. set to YES if loaded via json
  39. - (id)initWithJsonData:(NSDictionary*)jsonData;
  40. - (id)initWithCoder:(NSCoder *)aDecoder;
  41. - (void)encodeWithCoder:(NSCoder *)aCoder;
  42. + (BOOL)defaultRouteExists:(NSArray<Network *>*)netList;
  43. - (NSString*)statusString;
  44. - (NSString*)typeString;
  45. @end