xref: /optee_os/lib/libutee/include/pta_socket.h (revision b1469ba0bfd0371eb52bd50f5c52eeda7a8f5f1e)
1 /*
2  * Copyright (c) 2016, Linaro Limited
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef __PTA_SOCKET
29 #define __PTA_SOCKET
30 
31 #define PTA_SOCKET_UUID { 0x3b996a7d, 0x2c2b, 0x4a49, { \
32 			  0xa8, 0x96, 0xe1, 0xfb, 0x57, 0x66, 0xd2, 0xf4 } }
33 
34 /*
35  * [in]		value[0].a	ip version TEE_IP_VERSION_* from tee_ipsocket.h
36  * [in]		value[0].b	server port number
37  * [in]		memref[1]	server address
38  * [in]		value[2].a	protocol, TEE_ISOCKET_PROTOCOLID_*
39  * [out]	value[3].a	socket handle
40  */
41 #define PTA_SOCKET_OPEN		1
42 
43 /*
44  * [in]		value[0].a	socket handle
45  */
46 #define PTA_SOCKET_CLOSE	2
47 
48 #define PTA_SOCKET_TIMEOUT_NONBLOCKING	0
49 #define PTA_SOCKET_TIMEOUT_BLOCKING	0xffffffff
50 
51 /*
52  * [in]		value[0].a	socket handle
53  * [in]		value[0].b	timeout ms or TEE_TIMEOUT_INFINITE
54  * [in]		memref[1]	buffer to transmit
55  * [out]	value[2].a	number of transmitted bytes
56  */
57 #define PTA_SOCKET_SEND		3
58 
59 /*
60  * [in]		value[0].a	socket handle
61  * [in]		value[0].b	timeout ms or TEE_TIMEOUT_INFINITE
62  * [out]	memref[1]	buffer
63  */
64 #define PTA_SOCKET_RECV		4
65 
66 /*
67  * [in]		value[0].a	socket handle
68  * [in]		value[0].b	ioctl command
69  * [in/out]	memref[1]	buffer
70  */
71 #define PTA_SOCKET_IOCTL	5
72 
73 #endif /*__PTA_SOCKET*/
74