Dali 3D User Interface Engine
socket-interface.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_ADAPTOR_BASE_SOCKET_INTERFACE_H__
2 #define __DALI_INTERNAL_ADAPTOR_BASE_SOCKET_INTERFACE_H__
3 
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 #include <stdint.h>
22 
23 namespace Dali
24 {
25 namespace Internal
26 {
27 namespace Adaptor
28 {
29 
52 {
53 public:
54 
58  enum Protocol
59  {
60  TCP,
61  UDP,
62  };
63 
68  virtual bool SocketIsOpen() const = 0;
69 
74  virtual bool CloseSocket() = 0;
75 
81  virtual bool Bind( uint16_t port ) = 0;
82 
88  virtual bool Listen( int blacklog) = 0;
89 
94  virtual SocketInterface* Accept() const = 0;
95 
100  {
104  };
105 
115  virtual SelectReturn Select() = 0;
116 
120  virtual void ExitSelect() = 0;
121 
129  virtual bool Read( void* buffer, unsigned int bufferSizeInBytes, unsigned int& bytesRead ) = 0;
130 
137  virtual bool Write( const void* buffer, unsigned int bufferSizeInBytes ) = 0;
138 
139  //
140  // Common socket options. Please add more as required.
141  // These should be wrappers around the setsockopt API
142 
148  virtual bool ReuseAddress( bool reUse ) = 0;
149 
154  {
157  };
158 
165  virtual bool SetBufferSize( BufferType type, unsigned int size ) = 0;
166 
167 protected:
168 
173  {
174  }
175 
180  {
181  }
182 
183 private:
184 
185  // Undefined copy constructor.
187 
188  // Undefined assignment operator.
190 
191 };
192 
193 
194 } // Adaptor
195 } // Internal
196 } // Dali
197 
198 #endif // __DALI_INTERNAL_ADAPTOR_BASE_SOCKET_INTERFACE_H__
Dali Docs Home
Read more about Dali