Skip to main content

TcpIpStack

Struct TcpIpStack 

Source
pub struct TcpIpStack;

Implementations§

Source§

impl TcpIpStack

Source

pub const fn new() -> Self

Source

pub fn web_get( &self, is_https: bool, host: &str, path: &str, ) -> Result<AppHttpResponse, TcpIpError>

Source

pub fn web_post( &self, is_https: bool, host: &str, path: &str, content_type: &str, body: &[u8], ) -> Result<AppHttpResponse, TcpIpError>

is_https に応じて HTTPS(TLS) / HTTP の POST を振り分ける。 HTTPS フォーム送信が平文 HTTP に落ちてボディが届かない不具合を防ぐ。

Source

pub fn web_get_binary( &self, is_https: bool, host: &str, path: &str, ) -> Result<Vec<u8>, TcpIpError>

Source

pub fn web_request( &self, is_https: bool, host: &str, path: &str, method: &str, content_type: &str, body: &[u8], ) -> Result<AppHttpResponse, TcpIpError>

任意メソッド(GET/POST/PUT/DELETE/PATCH/HEAD 等)の HTTP/HTTPS リクエスト。 method は英大文字トークンへ正規化し、未知の文字は弾く(ヘッダインジェクション防止)。 is_https に応じて TLS 経路(tls::https_request)と平文経路(http_request_real)を振り分ける。

Trait Implementations§

Source§

impl ApplicationLayerApi for TcpIpStack

Source§

fn http_get( &self, host: &str, path: &str, ) -> Result<AppHttpResponse, TcpIpError>

Source§

fn https_get( &self, host: &str, path: &str, ) -> Result<AppHttpResponse, TcpIpError>

Source§

fn http_post( &self, host: &str, path: &str, content_type: &str, body: &[u8], ) -> Result<AppHttpResponse, TcpIpError>

Source§

impl Default for TcpIpStack

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl InternetLayerApi for TcpIpStack

Source§

fn resolve_a(&self, host: &str) -> Result<[u8; 4], TcpIpError>

Source§

impl LinkLayerApi for TcpIpStack

Source§

impl TransportLayerApi for TcpIpStack

Source§

fn tcp_connect( &self, remote_ip: [u8; 4], remote_port: u16, ) -> Result<u16, TcpIpError>

Source§

fn tcp_send(&self, local_port: u16, data: &[u8]) -> Result<(), TcpIpError>

Source§

fn tcp_recv( &self, local_port: u16, timeout_iters: usize, ) -> Result<Vec<u8>, TcpIpError>

Source§

fn tcp_close(&self, local_port: u16) -> Result<(), TcpIpError>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.