ic_c_protocol

IC C Protocol Functions

This manual page lists some of the functions of the IC C runtime library that are used internally for the IC protocol.

The listed functions are used internally by generated C client and server code. They are documented here for the advanced user that want to replace the default protocol (Erlang distribution + gen_server) by his own protocol, For each set of client or sever functions below with prefix oe, the user has to implement his own set of functions, the names of which are obtained by replacing the oe prefix by Prefix. The Prefix has to be set with the option {user_protocol, Prefix} at compile time.

The following terminology is used (reflected in names of functions): a notification is a message send from client to server, without any reply back (i.e. a oneway operation); a request is a message sent from client to server, and where a reply message is sent back from the server to the client.

In order to understand how the functions work and what they do the user must study their implementation in the IC C library (source file is ic.c), and also consider how they are used in the C code of ordinary generated client stubs or server skeletons.

Client Protocol Functions

The following functions are used internally by generated C client code.

Functions


The result of this function is the beginning of a binary of in external format of the tuple {'$gen_cast', X} where X is not yet filled in.

In generated client code this function is the first to be called in the encoding function for each oneway operation.

Sends a client notification to a server according to the Erlang distribution + gen_server protocol.

The send_ms parameter specified a timeout in milliseconds.

The result of this function is the beginning of a binary in the external format of the tuple {'$gen_call', {Pid, Ref}, X} where X is not yet filled in.

In generated client code this function is the first to be called in the encoding function for each twoway operation.

Sends a client request and receives the reply according to the Erlang distribution + gen_server protocol. This function calls the oe_prepare_reply_decoding function in order to obtain the gen_server reply.

send_ms and recv_ms specify timeouts for send and receive, respectively, in milliseconds.

Decodes the binary version of the tuple {Ref, X}, where X is to be decoded later by the specific client decoding function.

Server Protocol Functions

The following functions are used internally by generated C server code.

Functions


Decodes the binary version of the tuple {'$gen_cast', Op} (Op an atom), or the tuple {'$gen_cast', {Op, X}}, where Op is the operation name, and where X is to be decoded later by the specific operation decoding function; or

decodes the binary version of the tuple {'$gen_call', {Pid, Ref}, Op} (Op an atom), or the tuple {'$gen_call', {Pid, Ref}, {Op, X}}, where Op> is the operation name, and X is to be decode later by the specific operation decoding function.

Encodes the beginning of the binary version of the tuple {{Ref,X}, where X is to be filled in by the specific server encoding function.

SEE ALSO

ic(3), ic_clib(3), IC Protocol

View Functions