1 // Licensed to the Apache Software Foundation (ASF) under one 2 // or more contributor license agreements. See the NOTICE file 3 // distributed with this work for additional information 4 // regarding copyright ownership. The ASF licenses this file 5 // to you under the Apache License, Version 2.0 (the 6 // "License"); you may not use this file except in compliance 7 // with the License. You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, 12 // software distributed under the License is distributed on an 13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 // KIND, either express or implied. See the License for the 15 // specific language governing permissions and limitations 16 // under the License. 17 18 use super::*; 19 use libc::*; 20 21 pub type TEE_iSocketHandle = *mut c_void; 22 pub type TEE_iSocket = TEE_iSocket_s; 23 24 #[repr(C)] 25 #[derive(Debug, Copy, Clone)] 26 pub struct TEE_iSocket_s { 27 pub TEE_iSocketVersion: u32, 28 pub protocolID: u8, 29 pub open: unsafe extern "C" fn( 30 ctx: *mut TEE_iSocketHandle, 31 setup: *mut c_void, 32 protocolError: *mut u32, 33 ) -> TEE_Result, 34 pub close: unsafe extern "C" fn(ctx: TEE_iSocketHandle) -> TEE_Result, 35 pub send: unsafe extern "C" fn( 36 ctx: TEE_iSocketHandle, 37 buf: *const c_void, 38 length: *mut u32, 39 timeout: u32, 40 ) -> TEE_Result, 41 pub recv: unsafe extern "C" fn( 42 ctx: TEE_iSocketHandle, 43 buf: *mut c_void, 44 length: *mut u32, 45 timeout: u32, 46 ) -> TEE_Result, 47 pub error: unsafe extern "C" fn(ctx: TEE_iSocketHandle) -> u32, 48 pub ioctl: unsafe extern "C" fn( 49 ctx: TEE_iSocketHandle, 50 commandCode: u32, 51 buf: *mut c_void, 52 length: *mut u32, 53 ) -> TEE_Result, 54 } 55 56 pub const TEE_ISOCKET_VERSION: u32 = 0x01000000; 57 58 pub const TEE_ISOCKET_ERROR_PROTOCOL: u32 = 0xF1007001; 59 pub const TEE_ISOCKET_ERROR_REMOTE_CLOSED: u32 = 0xF1007002; 60 pub const TEE_ISOCKET_ERROR_TIMEOUT: u32 = 0xF1007003; 61 pub const TEE_ISOCKET_ERROR_OUT_OF_RESOURCES: u32 = 0xF1007004; 62 pub const TEE_ISOCKET_ERROR_LARGE_BUFFER: u32 = 0xF1007005; 63 pub const TEE_ISOCKET_WARNING_PROTOCOL: u32 = 0xF1007006; 64 pub const TEE_ISOCKET_ERROR_HOSTNAME: u32 = 0xF1007007; 65