Twitch SDK (Internal)
standardfilesocket.h
Go to the documentation of this file.
1 /********************************************************************************************
2 * Twitch Broadcasting SDK
3 *
4 * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5 * may not be copied or used except in accordance with the terms of that agreement
6 * Copyright (c) 2012-2016 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #pragma once
10 
11 #include "twitchsdk/core/socket.h"
12 
13 namespace ttv
14 {
15  class StandardFileSocket;
16  class StandardFileSocketFactory;
17 }
18 
19 
21 {
22 public:
24  virtual ~StandardFileSocket();
25 
26  TTV_ErrorCode Initialize(const std::string& inputPath, const std::string& outputPath);
27 
28  // ISocket Implementation
29  virtual TTV_ErrorCode Connect();
30  virtual TTV_ErrorCode Disconnect();
31  virtual TTV_ErrorCode Send(const uint8_t* buffer, size_t length, size_t& sent);
32  virtual TTV_ErrorCode Recv(uint8_t* buffer, size_t length, size_t& received);
33  virtual uint64_t TotalSent();
34  virtual uint64_t TotalReceived();
35  virtual bool Connected();
36 
37 private:
38  std::string mInputFilePath;
39  std::string mOutputFilePath;
40  FILE* mInputFile;
41  FILE* mOutputFile;
42  uint64_t mTotalSent;
43  uint64_t mTotalRecieved;
44  bool mConnected;
45 };
46 
47 
49 {
50 public:
51  virtual ~StandardFileSocketFactory();
52 
53  virtual bool IsProtocolSupported(const std::string& protocol);
54  virtual TTV_ErrorCode CreateSocket(const std::string& uri, std::shared_ptr<ISocket>& result);
55 };
Definition: standardfilesocket.h:20
TTV_ErrorCode CreateSocket(const std::string &uri, std::shared_ptr< ISocket > &result)
FILE * mOutputFile
Definition: standardfilesocket.h:41
uint64_t mTotalRecieved
Definition: standardfilesocket.h:43
virtual TTV_ErrorCode Connect()
virtual TTV_ErrorCode Send(const uint8_t *buffer, size_t length, size_t &sent)
TTV_ErrorCode Initialize(const std::string &inputPath, const std::string &outputPath)
virtual TTV_ErrorCode Recv(uint8_t *buffer, size_t length, size_t &received)
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
Definition: standardfilesocket.h:48
virtual uint64_t TotalSent()
uint64_t mTotalSent
Definition: standardfilesocket.h:42
bool mConnected
Definition: standardfilesocket.h:44
std::string mInputFilePath
Definition: standardfilesocket.h:38
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
virtual bool Connected()
Definition: socket.h:181
Definition: socket.h:405
FILE * mInputFile
Definition: standardfilesocket.h:40
std::string mOutputFilePath
Definition: standardfilesocket.h:39
virtual TTV_ErrorCode Disconnect()
virtual uint64_t TotalReceived()