equal
deleted
inserted
replaced
24 class NetworkTCPTransport { |
24 class NetworkTCPTransport { |
25 protected: |
25 protected: |
26 /** |
26 /** |
27 * The SOCK_STREAM socket |
27 * The SOCK_STREAM socket |
28 */ |
28 */ |
29 NetworkSocket socket; |
29 NetworkSocket *socket; |
30 |
30 |
31 /** |
31 /** |
32 * Our input buffer associated with socket |
32 * Our input buffer associated with socket |
33 */ |
33 */ |
34 NetworkBufferInput in; |
34 NetworkBufferInput in; |
42 |
42 |
43 public: |
43 public: |
44 /** |
44 /** |
45 * Construct this using the given socket |
45 * Construct this using the given socket |
46 */ |
46 */ |
47 NetworkTCPTransport (NetworkSocket socket); |
47 NetworkTCPTransport (NetworkSocket *socket); |
|
48 |
|
49 /** |
|
50 * Deletes the socket |
|
51 */ |
|
52 ~NetworkTCPTransport (void); |
48 |
53 |
49 private: |
54 private: |
50 /** |
55 /** |
51 * Triggered when the socket is read for recv |
56 * Triggered when the socket is read for recv |
52 */ |
57 */ |
54 |
59 |
55 /** |
60 /** |
56 * Triggered when the socket is read for send |
61 * Triggered when the socket is read for send |
57 */ |
62 */ |
58 void on_write (void); |
63 void on_write (void); |
59 |
|
60 /** |
|
61 * Triggered when the socket is disconnected (?) |
|
62 */ |
|
63 void on_disconnected (void); |
|
64 |
64 |
65 /** |
65 /** |
66 * The packet-read signal |
66 * The packet-read signal |
67 */ |
67 */ |
68 CL_Signal_v1<NetworkPacketInput&> _sig_packet; |
68 CL_Signal_v1<NetworkPacketInput&> _sig_packet; |
72 */ |
72 */ |
73 CL_Signal_v0 _sig_disconnect; |
73 CL_Signal_v0 _sig_disconnect; |
74 |
74 |
75 public: |
75 public: |
76 /** |
76 /** |
77 * Get this TCP socket's local ddress |
77 * Get this TCP socket's local address |
78 */ |
78 */ |
79 NetworkAddress getLocalAddress (void) { return socket.get_source_address(); } |
79 NetworkAddress getLocalAddress (void) { return socket->get_local_address(); } |
80 |
80 |
81 /** |
81 /** |
82 * Get this TCP socket's remote address |
82 * Get this TCP socket's remote address |
83 */ |
83 */ |
84 NetworkAddress getRemoteAddress (void) { return socket.get_dest_address(); } |
84 NetworkAddress getRemoteAddress (void) { return socket->get_remote_address(); } |
85 |
85 |
86 /** |
86 /** |
87 * Write the given packet to this socket output, buffering the data if need be |
87 * Write the given packet to this socket output, buffering the data if need be |
88 * |
88 * |
89 * @param packet the packet to send |
89 * @param packet the packet to send |
136 * |
136 * |
137 * By default, this just constructs a new NetworkTCPTransport and returns it |
137 * By default, this just constructs a new NetworkTCPTransport and returns it |
138 * |
138 * |
139 * @param socket the socket returned by accept() |
139 * @param socket the socket returned by accept() |
140 */ |
140 */ |
141 virtual NetworkTCPTransport* buildTransport (CL_Socket &socket); |
141 virtual NetworkTCPTransport* buildTransport (NetworkSocket *socket); |
142 |
142 |
143 public: |
143 public: |
144 /** |
144 /** |
145 * A new client has connected, and a NetworkTCPTransport has been connected for it |
145 * A new client has connected, and a NetworkTCPTransport has been connected for it |
146 */ |
146 */ |