Merge pull request #2318 from jwillemsen/jwi-add_forward_profiles
[ACE_TAO.git] / ACE / examples / IPC_SAP / SSL_SAP / SSL-client.h
blob57857970701e52cdb6573949ed49810636a015f4
1 // -*- C++ -*-
2 // This file defines the Options class for SSL-client. IBM C++ compiler'd
3 // template auto-instantiator needs this in a separate file.
5 #ifndef __ACE_SSL_CLIENT_H
6 #define __ACE_SSL_CLIENT_H
8 #include "ace/Barrier.h"
9 #include "ace/Time_Value.h"
11 #include "ace/SSL/SSL_SOCK_Stream.h"
13 /// Define the options for this test.
14 class Options
16 public:
17 // Constructor.
18 Options ();
20 // Destructor.
21 ~Options ();
23 // Parse the command-line arguments.
24 int parse_args (int argc, ACE_TCHAR *argv[]);
26 // Return the amount of time to sleep in order to implement the
27 // proper transmission rates.
28 const ACE_Time_Value &sleep_time () const;
30 // Port of the server.
31 u_short port () const;
33 // Host of the server.
34 const ACE_TCHAR *host () const;
36 // Number of threads.
37 size_t threads () const;
39 // String that shuts down the client/server.
40 const char *quit_string () const;
42 // Read from the appropriate location.
43 ssize_t read (void *buf, size_t len, size_t &iterations);
45 // Returns the length of the message to send.
46 size_t message_len () const;
48 // Returns a pointer to the message.
49 const void *message_buf () const;
51 // Returns a pointer to the entry point into the thread that runs
52 // the client test function.
53 ACE_THR_FUNC thr_func ();
55 private:
56 // Initialize the message we're sending to the user and set up the
57 // barrier.
58 int init ();
60 // Performs the shared behavior of the oneway and twoway client
61 // tests.
62 char *shared_client_test (u_short port,
63 ACE_SSL_SOCK_Stream &cli_stream);
65 // Performs the twoway test.
66 static void *twoway_client_test (void *);
68 // Performs the oneway test.
69 static void *oneway_client_test (void *);
71 // Host of the server.
72 const ACE_TCHAR *host_;
74 // Port of the server.
75 u_short port_;
77 // Sleep_Time value.
78 ACE_Time_Value sleep_time_;
80 // Number of threads.
81 size_t threads_;
83 // String that shuts down the client/server.
84 enum {QUIT_STRING_SIZE = 128};
85 char quit_string_[QUIT_STRING_SIZE + 1];
87 size_t message_len_;
88 // Size of the message we send to the server.
90 char *message_buf_;
91 // Pointer to the message we send to the server.
93 ACE_HANDLE io_source_;
94 // Are we reading I/O from ACE_STDIN or from our generator?
96 size_t iterations_;
97 // Number of iterations.
99 char oneway_;
100 // Are we running oneway or twoway?
102 // Please leave the ; inside the parenthesis to avoid Green Hills
103 // (and probably other) compiler warning about extra ;.
104 ACE_MT (ACE_Barrier *barrier_;)
105 // Barrier used to synchronize the start of all the threads.
108 #endif /* __ACE_SSL_CLIENT_H */