summaryrefslogtreecommitdiff
path: root/examples/Connection/blocking/SPIPE-acceptor.h
blob: aee2d645ca5388f3565a707a19d27212d452e58a (plain)
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
59
60
61
62
63
/* -*- C++ -*- */
// $Id$

#if !defined (SP_ACCEPTOR_H)
#define SP_ACCEPTOR_H

#include "ace/Svc_Handler.h"
#include "ace/Acceptor.h"
#include "ace/SPIPE_Stream.h"
#include "ace/SPIPE_Acceptor.h"

// This is the class that does the work once the ACE_Oneshot_Acceptor
// has accepted a connection.

class Svc_Handler : public ACE_Svc_Handler <ACE_SPIPE_STREAM, ACE_NULL_SYNCH>
{
public:
  Svc_Handler (void);
  ~Svc_Handler (void);

  virtual int open (void *);

  virtual ACE_Message_Block *get_message (void);

  virtual int handle_input_complete (ACE_Message_Block *msg, 
				    long bytes_transfered);
  // Handle data from the client.

private:
};

class IPC_Server : public ACE_Oneshot_Acceptor<Svc_Handler, ACE_SPIPE_ACCEPTOR>
{
public:
  IPC_Server (void);
  ~IPC_Server (void);

  // = Dynamic linking hooks.
  virtual int init (int argc, char *argv[]);
  // Initialize the network server.

  virtual int fini (void);
  // Close down the server.

  virtual int svc (void);
  // Run the interative service.

private:
  int parse_args (int argc, char *argv[]);
  // Parse command-line arguments.

  int n_threads_;
  // Size of thread pool to use.

  const char *rendezvous_;
  // Meeting place for pipe.

  ACE_Sig_Adapter done_handler_;
  // Keeps track of when we shut down due to receipt of the SIGINT
  // signal.
};

#endif /* SP_ACCEPTOR_H */