-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThreadSpecificServer.hpp
58 lines (40 loc) · 1.75 KB
/
ThreadSpecificServer.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef THREAD_SPECIFIC_SERVER_HPP_INCLUDE_GUARD_32045735827708
#define THREAD_SPECIFIC_SERVER_HPP_INCLUDE_GUARD_32045735827708
#include "ServiceBase.hpp"
#include "Server.hpp"
namespace dicom
{
//! stuff in here isn't expected to be directly used by the end programmer
namespace Implementation
{
//!Manages communications with one client connection. Should be created on it's own thread.
/*!
Instances of this class are created by the threading framework and are responsible
for managing ONE client connection. (Server is the 'managing' class that represents
the state and parameters of the entire service).
This class gets treated as a FUNCTOR by Server::Serve()
This means it gets copied around quite a lot, so it shouldn't have
too many data members. It may be that we should introduce some kind
of intermediate class between Server and ThreadSpecificServer.
this should probably include a state variable as described in Part8, Table 9.2
*/
struct ThreadSpecificServer : public ServiceBase
{
Server& server_;
Network::AcceptedSocket* socket_;
virtual Network::Socket* GetSocket(){return socket_;}
bool AssociationNegotiated_;
//!This gets created by the ThreadedServer framework
ThreadSpecificServer(Network::AcceptedSocket* socket,Server& s);
//! Thread function - gets called by newly created thread.
void operator()();
//!this gets called when data is available on socket.
void HandleData();
void NegotiateAssociation();
void Dispatch(DataSet& command);
void ProcessRequest();
bool InterogateAAssociateRQ(const primitive::AAssociateRQ& association_request);
};
}//namespace Implementation
}//namespace dicom
#endif//THREAD_SPECIFIC_SERVER_HPP_INCLUDE_GUARD_32045735827708