Module leo_rpc_protocol

leo_rpc_protocol handles requested data with the protocol.

References

Description

leo_rpc_protocol handles requested data with the protocol

Function Index

handle_call/3Receive data from client(s) after that convert from param to binary.
init/1Initialize the protocol.
param_to_binary/3Convert from param to binary.
result_to_binary/1Convert from result-value to binary.
start_link/0Start leo_rpc's server.
start_link/1Start leo_rpc's server.
stop/0Stop leo_rpc's server.

Function Details

handle_call/3

handle_call(Socket, Data, State) -> {reply, binary()} | {close, State}

Receive data from client(s) after that convert from param to binary

  dat-format:
  << "*",
     $ModMethodBin/binary,    "/r/n",
     $ParamsLenBin:8/integer, $BodyLen:32/integer, "/r/n",
     $Param_1_Bin_Len/binary, "/r/n", "T"|"B", $Param_1_Bin/binary, "/r/n",
     ...
     $Param_N_Bin_Len/binary, "/r/n", "T"|"B", $Param_N_Bin/binary, "/r/n",
     "/r/n" >>
  

init/1

init(X1::term()) -> {ok, null}

Initialize the protocol

param_to_binary/3

param_to_binary(Mod, Method, Args) -> binary()

Convert from param to binary

  Format:
  << "*",
     $ModMethodBin/binary,    "/r/n",
     $ParamsLenBin:8/integer, $BodyLen:32/integer, "/r/n",
     $Param_1_Bin_Len/binary, "/r/n", "T"|"B", $Param_1_Bin/binary, "/r/n",
     ...
     $Param_N_Bin_Len/binary, "/r/n", "T"|"B", $Param_N_Bin/binary, "/r/n",
     "/r/n" >>
  

result_to_binary/1

result_to_binary(Term) -> binary()

Convert from result-value to binary

  Format:
  << "*",
     $OriginalDataTypeBin/binary, ResultBodyLen/integer, "/r/n",
     $BodyBin_1_Len/integer,      "/r/n",
     $BodyBin_1/binary,           "/r/n",
     ...
     $BodyBin_N_Len/integer,      "/r/n",
     $BodyBin_N/binary,           "/r/n",
     "/r/n"
     >>
  

start_link/0

start_link() -> ok | {error, any()}

Start leo_rpc's server

start_link/1

start_link(Params) -> ok | {error, any()}

Start leo_rpc's server

stop/0

stop() -> ok | {error, any()}

Stop leo_rpc's server


Generated by EDoc