summaryrefslogtreecommitdiff
path: root/include/secure_socket.h
blob: c5c7c3502fab4b906a0b7e26d39da5a4e2c40bbb (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
64
65
66
67
68
69
70
71
72
73
/*
 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
*/

#ifndef _SECURE_SOCKET_H
#define _SECURE_SOCKET_H

#ifdef __cplusplus
extern "C" {
#endif

/*!
 * local:///tmp/.socket.file => /tmp/.socket.file
 */
#define COM_CORE_LOCAL_SCHEME		"local://"
#define COM_CORE_LOCAL_SCHEME_LEN	(8)

/*!
 * remote://IPADDR:PORT
 * remote://:PORT	=> Using INADDR_ANY in this case
 */
#define COM_CORE_REMOTE_SCHEME		"remote://"
#define COM_CORE_REMOTE_SCHEME_LEN	(9)

/*
 * Create client connection
 */
extern int secure_socket_create_client(const char *peer);

/*
 * Create server connection
 */
extern int secure_socket_create_server(const char *peer);

/*
 * Get the raw handle to use it for non-blocking mode.
 */
extern int secure_socket_get_connection_handle(int server_handle);

/*
 * Send data to the connected peer.
 */
extern int secure_socket_send(int conn, const char *buffer, int size);

/*
 * Recv data from the connected peer. and its PID value
 */
extern int secure_socket_recv(int conn, char *buffer, int size, int *sender_pid);

/*
 * Destroy a connection
 */
extern int secure_socket_destroy_handle(int conn);

#ifdef __cplusplus
}
#endif

#endif
/* End of a file */