ServerConnector.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2012-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import <Foundation/Foundation.h>
  21. #import "GCDAsyncSocket.h"
  22. #import "NaClCrypto.h"
  23. #import "AbstractGroupMessage.h"
  24. @class BoxedMessage;
  25. @interface ServerConnector : NSObject <GCDAsyncSocketDelegate>
  26. enum ConnectionState {
  27. ConnectionStateDisconnected = 1,
  28. ConnectionStateConnecting,
  29. ConnectionStateConnected,
  30. ConnectionStateLoggedIn,
  31. ConnectionStateDisconnecting
  32. };
  33. @property (nonatomic, readwrite) enum ConnectionState connectionState;
  34. @property (nonatomic, readwrite) double lastRtt;
  35. @property (nonatomic, readonly) BOOL isIPv6Connection;
  36. @property (nonatomic, readonly) BOOL isProxyConnection;
  37. + (ServerConnector*)sharedServerConnector;
  38. - (void)connect;
  39. - (void)connectWait;
  40. - (void)disconnect;
  41. - (void)disconnectWait;
  42. - (void)reconnect;
  43. - (NSString*)nameForConnectionState:(enum ConnectionState)connectionState;
  44. - (void)sendMessage:(BoxedMessage*)message;
  45. - (void)ackMessage:(NSData*)messageId fromIdentity:(NSString*)fromIdentity;
  46. - (void)ping;
  47. - (void)cleanPushToken;
  48. - (void)setVoIPPushToken:(NSData *)voIPPushToken;
  49. - (void)sendPushAllowedIdentities;
  50. - (void)setServerPorts: (NSArray *) ports;
  51. - (void)sendPushOverrideTimeout;
  52. - (void)resetPushOverrideTimeout;
  53. - (void)completedProcessingAbstractMessage:(AbstractGroupMessage *)abstractGroupMsg;
  54. @end