Added Android code
[wl-app.git] / iOS / Pods / FirebaseMessaging / Firebase / Messaging / FIRMessagingSecureSocket.h
1 /*
2  * Copyright 2017 Google
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #import <Foundation/Foundation.h>
18
19 typedef NS_ENUM(NSUInteger, FIRMessagingSecureSocketState){
20   kFIRMessagingSecureSocketNotOpen = 0,
21   kFIRMessagingSecureSocketOpening,
22   kFIRMessagingSecureSocketOpen,
23   kFIRMessagingSecureSocketClosing,
24   kFIRMessagingSecureSocketClosed,
25   kFIRMessagingSecureSocketError
26 };
27
28 @class FIRMessagingSecureSocket;
29
30 @protocol FIRMessagingSecureSocketDelegate<NSObject>
31
32 - (void)secureSocket:(FIRMessagingSecureSocket *)socket
33       didReceiveData:(NSData *)data
34              withTag:(int8_t)tag;
35 - (void)secureSocket:(FIRMessagingSecureSocket *)socket
36  didSendProtoWithTag:(int8_t)tag
37                rmqId:(NSString *)rmqId;
38 - (void)secureSocketDidConnect:(FIRMessagingSecureSocket *)socket;
39 - (void)didDisconnectWithSecureSocket:(FIRMessagingSecureSocket *)socket;
40
41 @end
42
43 /**
44  * This manages the input/output streams connected to the MCS server. Used to receive data from
45  * the server and send to it over the wire.
46  */
47 @interface FIRMessagingSecureSocket : NSObject
48
49 @property(nonatomic, readwrite, weak) id<FIRMessagingSecureSocketDelegate> delegate;
50 @property(nonatomic, readonly, assign) FIRMessagingSecureSocketState state;
51
52 - (void)connectToHost:(NSString *)host port:(NSUInteger)port onRunLoop:(NSRunLoop *)runLoop;
53 - (void)disconnect;
54 - (void)sendData:(NSData *)data withTag:(int8_t)tag rmqId:(NSString *)rmqId;
55
56 @end