ffead.server.doc
ClientInterface.h
1 /*
2  Copyright 2010, Sumeet Chhetri
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  * ClientInterface.h
18  *
19  * Created on: Dec 23, 2012
20  * Author: sumeet
21  */
22 
23 #ifndef CLIENT_INTERFACE_H_
24 #define CLIENT_INTERFACE_H_
25 #include "iostream"
26 #include "sstream"
27 #include <fcntl.h>
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <unistd.h>
31 #include <errno.h>
32 #include <string.h>
33 #include <netdb.h>
34 #include <sys/types.h>
35 #include <netinet/in.h>
36 #include <sys/socket.h>
37 #include <arpa/inet.h>
38 #include "string"
39 #include "cstring"
40 #include <signal.h>
41 #include <openssl/err.h>
42 #include <openssl/ssl.h>
43 #include "CastUtil.h"
44 #include "Logger.h"
45 using namespace std;
46 
47 #define MAXBUFLE 32768
49 {
50 public:
51  virtual bool connection(string,int)=0;
52  virtual void closeConnection()=0;
53  virtual bool connectionUnresolv(string host,int port)=0;
54  virtual bool isConnected()=0;
55  virtual int sendData(string)=0;
56  virtual string getBinaryData(int,bool)=0;
57  virtual string getTextData(string hdrdelm,string cntlnhdr)=0;
58  int getLengthCl(string header,int size);
59  void *get_in_addr(struct sockaddr *sa);
60  int create_tcp_socket();
61  static char* get_ip(char *host);
62  static bool isConnected(int fd);
63 };
64 
65 #endif /* CLIENT_INTERFACE_H_ */