4 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
23 #include <sys/types.h>
24 #include <sys/socket.h>
29 #include <sensor_log.h>
36 csocket(const csocket &sock);
39 bool create(int sock_type);
40 bool bind(const char *sock_path);
41 bool listen(const int max_connections);
42 bool accept(csocket& client_socket) const;
45 bool connect(const char *sock_path);
48 ssize_t send(const void *buffer, size_t size) const;
49 ssize_t recv(void* buffer, size_t size) const;
51 bool set_connection_mode(void);
52 bool set_transfer_mode(void);
53 bool is_blocking_mode(void);
55 //check if socket is created
56 bool is_valid(void) const;
57 int get_socket_fd(void) const;
61 bool is_block_mode(void);
64 bool set_blocking_mode(bool blocking);
65 bool set_sock_type(void);
67 ssize_t send_for_seqpacket(const void *buffer, size_t size) const;
68 ssize_t send_for_stream(const void *buffer, size_t size) const;
69 ssize_t recv_for_seqpacket(void* buffer, size_t size) const;
70 ssize_t recv_for_stream(void* buffer, size_t size) const;
80 #endif /* _CSOCKET_H_ */