14 #include "interfaces/IAnnouncer.h" 15 #include "network/Network.h" 16 #include "threads/CriticalSection.h" 17 #include "threads/Thread.h" 18 #include "utils/HttpParser.h" 23 #include <sys/socket.h> 27 #define AIRPLAY_SERVER_VERSION_STR "101.28" 33 void Announce(ANNOUNCEMENT::AnnouncementFlag flag,
34 const std::string& sender,
35 const std::string& message,
39 static bool StartServer(
int port,
bool nonlocal);
40 static void StopServer(
bool bWait);
41 static bool IsRunning();
42 static bool SetCredentials(
bool usePassword,
const std::string& password);
43 static bool IsPlaying(){
return m_isPlaying > 0;}
44 static void backupVolume();
45 static void restoreVolume();
46 static int m_isPlaying;
49 void Process()
override;
54 bool SetInternalCredentials(
bool usePassword,
const std::string& password);
57 void AnnounceToClients(
int state);
66 CTCPClient(
const CTCPClient& client);
67 CTCPClient& operator=(
const CTCPClient& client);
69 int length, std::string &sessionId,
70 std::map<std::string, int> &reverseSockets);
71 void ComposeReverseEvent(std::string& reverseHeader, std::string& reverseBody,
int state);
76 struct sockaddr_storage m_cliaddr;
78 CCriticalSection m_critSection;
80 std::string m_sessionId;
83 int ProcessRequest( std::string& responseHeader,
84 std::string& response);
86 void ComposeAuthRequestAnswer(std::string& responseHeader, std::string& responseBody);
87 bool checkAuthorization(
const std::string& authStr,
const std::string& method,
const std::string& uri);
88 void Copy(
const CTCPClient& client);
91 bool m_bAuthenticated;
93 std::string m_authNonce;
96 CCriticalSection m_connectionLock;
97 std::vector<CTCPClient> m_connections;
98 std::map<std::string, int> m_reverseSockets;
99 std::vector<SOCKET> m_ServerSockets;
103 std::string m_password;
106 static CCriticalSection ServerInstanceLock;
Definition: AirPlayServer.h:29
Definition: IAnnouncer.h:70
Definition: HttpParser.h:42