#ifndef _CLIENTSOCKET_H_
#define _CLIENTSOCKET_H_

#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

enum storetype {
  FILESTORE = 1,
  DIRSTORE
};

typedef enum storetype StoreType;

using namespace std;

/*
ClientSocket Class
Author: Jacob Torrey
Date: 3/3/2008
Description: Provides a simple, easy to use overlay for connecting to
 servers using TCP
*/

class ClientSocket {
 public:
  ClientSocket(bool);
  ~ClientSocket();
  bool SetTrustStore(StoreType type, char * path);
  void IgnoreSSLErrors();
  bool Connect(char * host, int port);
  void Disconnect();
  bool Send(char* msg);
  char * Receive(int num);
 private:
  char * itoa(int num);
  char * storepath;
  StoreType type;
  bool sslconnect, ignoreErrors;
  BIO * bio;
  SSL_CTX * ctx;
  SSL * sslconn;
};

#include "ClientSocket.cpp"

#endif

