ivila commented on code in PR #164: URL: https://github.com/apache/incubator-teaclave-trustzone-sdk/pull/164#discussion_r1925192117
########## optee-utee/src/net/optee_std.rs: ########## @@ -0,0 +1,144 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + +use optee_utee_sys as raw; + +use super::optee::Setup; +use super::SocketError; +use super::{TcpStream, UdpSocket}; +use alloc::format; + +impl TcpStream { + fn connect_with_ip_version( + address: &str, + port: u16, + ip_version: raw::TEE_ipSocket_ipVersion, + ) -> std::io::Result<Self> { + let setup = Setup::new(address, port, ip_version) + .map_err(|_| std::io::Error::new(std::io::ErrorKind::Other, "Invalid address"))?; + Ok(Self::open(setup).map_err(|err| Into::<std::io::Error>::into(err))?) + } + pub fn connect_v4(address: &str, port: u16) -> std::io::Result<Self> { + Self::connect_with_ip_version(address, port, raw::TEE_ipSocket_ipVersion::TEE_IP_VERSION_4) + } + pub fn connect_v6(address: &str, port: u16) -> std::io::Result<Self> { + Self::connect_with_ip_version(address, port, raw::TEE_ipSocket_ipVersion::TEE_IP_VERSION_4) Review Comment: Yeah, I will add them in this commit, just try both v4 and v6 in the examples. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org For additional commands, e-mail: dev-h...@teaclave.apache.org