Changes

109 bytes added ,  14:51, 2 April 2015
restructured to emphasize the swrk mode
Line 1: Line 1: −
CRIU-RPC is a remote procedure call (RPC) protocol which uses Google Protocol Buffers to encode its calls. The requests are served by CRIU service launched with <code>criu service</code> command. It uses a SEQPACKET Unix domain socket listening at <code>/var/run/criu-service.socket</code> as a transport.
+
CRIU-RPC is a remote procedure call (RPC) protocol which uses Google Protocol Buffers to encode its calls. The requests are served by CRIU when either launched in so called "swrk" mode or by service started with the <code>criu service</code> command. It uses a SEQPACKET Unix domain socket for transport. In case of standalone service it listens at <code>/var/run/criu-service.socket</code> as a transport.
    
The criu_req/criu_resp are two main messages for requests/responses. They are to be used for transferring messages and needed to provide compatibility with an older versions of rpc. Field type in them ''must'' be set accordingly to type of request/response that is stored. Types of request/response are defined in enum criu_req_type. See the [[API compliance]] page for information what each option might mean.
 
The criu_req/criu_resp are two main messages for requests/responses. They are to be used for transferring messages and needed to provide compatibility with an older versions of rpc. Field type in them ''must'' be set accordingly to type of request/response that is stored. Types of request/response are defined in enum criu_req_type. See the [[API compliance]] page for information what each option might mean.
Line 5: Line 5:  
== Protocol ==
 
== Protocol ==
   −
The protocol is simple -- client connect to service, send a ''criu_req'' message to server, server responds back with ''criu_resp'' and closes the socket. There are three exceptions from this rule, see below.
+
The protocol is simple -- client sends a ''criu_req'' message to server, server responds back with ''criu_resp''. In most of the cases the socket gets closed, but there are three exceptions from this rule, see below.
    
== Request ==
 
== Request ==
Line 191: Line 191:     
== Run ==
 
== Run ==
 +
== SWRK mode ==
 +
 +
This mode turns on when one <code>fork() + exec()</code> CRIU with the <code>swrk</code> action and one more argument specifying the number of descriptor with ''seqpacket'' unix socket. With this CRIU works as service worker task accepting standard RPC requests via the mentioned socket and using one to do action scripts notifications and result reporting.
 +
 
=== Server ===
 
=== Server ===
 
On a server side, CRIU creates SOCK_SEQPACKET Unix socket and listens for connections on it. After receiving criu_req, CRIU processes it, do what is requested and sends criu_resp with set request-specific criu_***_resp field back.
 
On a server side, CRIU creates SOCK_SEQPACKET Unix socket and listens for connections on it. After receiving criu_req, CRIU processes it, do what is requested and sends criu_resp with set request-specific criu_***_resp field back.
Line 241: Line 245:     
There's a [[C_API|library]] that implements simple wrappers on top of RPC.
 
There's a [[C_API|library]] that implements simple wrappers on top of RPC.
  −
== SWRK mode ==
  −
  −
This mode turns on when one <code>fork() + exec()</code> CRIU with the <code>swrk</code> action and one more argument specifying the number of descriptor with ''seqpacket'' unix socket. With this CRIU works as service worker task accepting standard RPC requests via the mentioned socket and using one to do action scripts notifications and result reporting.
      
[[Category: API]]
 
[[Category: API]]