---
name: "ic_c_protocol"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:19.2.1+dfsg-2+deb9u3"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/ic_c_protocol"
---

# ic\_c\_protocol(3erl)

IC C Protocol Functions

## NAME

ic\_c\_protocol - IC C Protocol Functions

## DESCRIPTION

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.

## EXPORTS

**int oe\_prepare\_notification\_encoding(CORBA\_Environment \*env)**\

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.

**int oe\_send\_notification(CORBA\_Environment \*env)**\
 **int oe\_send\_notification\_tmo(CORBA\_Environment \*env,  unsigned int send\_ms)**\

Sends a client notification to a server according to the Erlang distribution + gen\_server protocol.

The *send\_ms* parameter specified a timeout in milliseconds.

**int oe\_prepare\_request\_encoding(CORBA\_Environment \*env)**\

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.

**int oe\_send\_request\_and\_receive\_reply(CORBA\_Environment \*env)**\
 **int oe\_send\_request\_and\_receive\_reply\_tmo(CORBA\_Environment \*env, unsigned int send\_ms, unsigned int recv\_ms)**\

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.

**int oe\_prepare\_reply\_decoding(CORBA\_Environment \*env)**\

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.

## EXPORTS

**int oe\_prepare\_request\_decoding(CORBA\_Environment \*env)**\

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.

**int oe\_prepare\_reply\_encoding(CORBA\_Environment \*env)**\

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(3erl)](/ic/3erl.md), [ic\_clib(3erl)](/ic_clib/3erl.md), **IC Protocol**
