Changes

Jump to navigation Jump to search
133 bytes added ,  20:59, 13 January 2017
minor rewording here and there
Line 1: Line 1: −
Libsoccr is the library that does [[TCP connection]] checkpoint and restore. It sits in criu sources and includes an API header and a static library.
+
Libsoccr is the library that does [[TCP connection]] checkpoint and restore. Currently it resides in criu source code (<code>soccr</code> subdirectory) and consists of an API header and a static library.
    
== Overview ==
 
== Overview ==
   −
To checkpoint a TCP connection one should
+
To checkpoint a TCP connection, one should
    
# ''pause'' a socket (referenced by descriptor)
 
# ''pause'' a socket (referenced by descriptor)
Line 11: Line 11:  
# close it
 
# close it
   −
To restore a connection one should
+
To restore a connection, one should
    
# create a socket
 
# create a socket
Line 23: Line 23:  
== Data types ==
 
== Data types ==
   −
In soccr/soccr.h there are three types declares
+
soccr/soccr.h declares three types:
    
; <code>struct libsoccr_sk</code>
 
; <code>struct libsoccr_sk</code>
: It's an abstract handler returned by ''pausing'' routine that is used as an opaque identifier by the rest of the libsoccr calls
+
: An abstract handler returned by ''pausing'' routine that is used as an opaque identifier by the rest of the libsoccr calls
    
; <code>struct libsoccr_sk_data</code>
 
; <code>struct libsoccr_sk_data</code>
Line 38: Line 38:  
Inside the <code>libsoccr_sk_data</code> structure there's a special field called <code>flags</code> that gives information about the meaning of some other fields. Though it's not bad just to pass this structure as-is between libsoccr calls, doing some optimization based on flags is OK.
 
Inside the <code>libsoccr_sk_data</code> structure there's a special field called <code>flags</code> that gives information about the meaning of some other fields. Though it's not bad just to pass this structure as-is between libsoccr calls, doing some optimization based on flags is OK.
   −
So here are the flags that make sense
+
Here are the flags that make sense:
    
; <code>SOCCR_FLAGS_WINDOW == 0x1</code>
 
; <code>SOCCR_FLAGS_WINDOW == 0x1</code>
: When set indicates, that fields <code>snd_wl1</code>, <code>snd_wnd</code>, <code>max_window</code>, <code>rcv_wnd</code> and <code>rcv_wup</code> contain some valuable data (0 is valid value for any)
+
: When set, indicates that fields <code>snd_wl1</code>, <code>snd_wnd</code>, <code>max_window</code>, <code>rcv_wnd</code> and <code>rcv_wup</code> contain some valuable data (0 is a valid value for any of these)
    
== Calls ==
 
== Calls ==
Line 62: Line 62:     
; <code>char *libsoccr_get_queue_bytes(struct libsoccr_sk *sk, int queue_id, unsigned flags)</code>
 
; <code>char *libsoccr_get_queue_bytes(struct libsoccr_sk *sk, int queue_id, unsigned flags)</code>
: Returns a malloc()-ed array with the contents of the queue. The queue can be TCP_RECV_QUEUE or TCP_SEND_QUEUE. The amount of bytes in each is <code>data.inq_len</code> and <code>data.outq_len</code> respectively. The <code>flags</code> may include <code>SOCCR_MEM_EXCL</code> bit (see below).
+
: Returns a malloc()-ed array with the contents of the queue. The queue can be TCP_RECV_QUEUE or TCP_SEND_QUEUE. The amount of bytes in each is <code>data.inq_len</code> and <code>data.outq_len</code> respectively. The <code>flags</code> may have <code>SOCCR_MEM_EXCL</code> bit set (see below).
    
; <code>union libsoccr_addr *libsoccr_get_addr(struct libsoccr_sk *sk, int self, unsigned flags)</code>  (currently unimplemented and returns NULL)
 
; <code>union libsoccr_addr *libsoccr_get_addr(struct libsoccr_sk *sk, int self, unsigned flags)</code>  (currently unimplemented and returns NULL)
: Returns address (self or peer) of the socket. The <code>flags</code> may include <code>SOCCR_MEM_EXCL</code> bit (see below)
+
: Returns address (self or peer) of the socket. The <code>flags</code> may have <code>SOCCR_MEM_EXCL</code> bit set (see below)
    
=== Restore ===
 
=== Restore ===
Line 79: Line 79:     
== Flags ==
 
== Flags ==
Here are the flags, that are accepted by various calls.
+
Here are the flags accepted by various calls.
    
; <code>SOCCR_MEM_EXCL</code>
 
; <code>SOCCR_MEM_EXCL</code>
: This flag means that the memory buffer set or get by the call is managed and should be freed by the recipient, i.e. when set the libsoccr will free() it, when get libsoccr won't do it expecting the caller to.
+
: Tells that the memory buffer set or get by the call is to be managed (and should be freed) by the ''receiving side''. In case of a get call the receiving side is the caller program, meaning it has to free() the buffer. In case of a set call the receiver is libsoccr, meaning libsoccr has to free() it.
    
[[Category: Sub-projects]]
 
[[Category: Sub-projects]]
 
[[Category: Sockets]]
 
[[Category: Sockets]]

Navigation menu