\doxysubsection{scoop.\+h File Reference}
\label{scoop_8h}\index{scoop.h@{scoop.h}}


Manage librsync streams of IO.  


Include dependency graph for scoop.\+h\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{scoop_8h__incl}
\end{center}
\end{figure}
This graph shows which files directly or indirectly include this file\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{scoop_8h__dep__incl}
\end{center}
\end{figure}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} \mbox{\hyperlink{scoop_8h_a5285265e3d220e43b8fd08867d708d9c}{rs\+\_\+tube\+\_\+catchup}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job)
\begin{DoxyCompactList}\small\item\em Put whatever will fit from the tube into the output of the stream. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{scoop_8h_afa78a2f17f45a022ec0f93a50c3f142d}{rs\+\_\+tube\+\_\+is\+\_\+idle}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} const $\ast$job)
\item 
void \mbox{\hyperlink{scoop_8h_a98f3b8fcc410948351d62728018ec67d}{rs\+\_\+tube\+\_\+write}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job, void const $\ast$buf, size\+\_\+t len)
\begin{DoxyCompactList}\small\item\em Push some data into the tube for storage. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{scoop_8h_aa1170d5552b5581630f90d8a66a71adc}{rs\+\_\+tube\+\_\+copy}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job, size\+\_\+t len)
\begin{DoxyCompactList}\small\item\em Queue up a request to copy through {\ttfamily len} bytes from the input to the output of the stream. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{scoop_8h_aad3e63ccd707266363d6feeca754a370}{rs\+\_\+scoop\+\_\+advance}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job, size\+\_\+t len)
\begin{DoxyCompactList}\small\item\em Advance the input cursor forward {\ttfamily len} bytes. \end{DoxyCompactList}\item 
\mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} \mbox{\hyperlink{scoop_8h_a026b9505478d48f4b9b05fea46c166e1}{rs\+\_\+scoop\+\_\+readahead}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job, size\+\_\+t len, void $\ast$$\ast$ptr)
\begin{DoxyCompactList}\small\item\em Read from scoop without advancing. \end{DoxyCompactList}\item 
\mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} \mbox{\hyperlink{scoop_8h_a9eb894edc12cd2972a1eb020bdc80725}{rs\+\_\+scoop\+\_\+read}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job, size\+\_\+t len, void $\ast$$\ast$ptr)
\begin{DoxyCompactList}\small\item\em Read LEN bytes if possible, and remove them from the input scoop. \end{DoxyCompactList}\item 
\mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} \mbox{\hyperlink{scoop_8h_af9c1b8a80bbed23d9409559fa101496b}{rs\+\_\+scoop\+\_\+read\+\_\+rest}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job, size\+\_\+t $\ast$len, void $\ast$$\ast$ptr)
\begin{DoxyCompactList}\small\item\em Read whatever data remains in the input stream. \end{DoxyCompactList}\item 
static size\+\_\+t \mbox{\hyperlink{scoop_8h_a28ab45a981e0a32d504f9eb3c6155798}{rs\+\_\+scoop\+\_\+avail}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job)
\item 
static bool \mbox{\hyperlink{scoop_8h_a6eb10b8ed1aa7f16ddf66e2e1051ff85}{rs\+\_\+scoop\+\_\+eof}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job)
\begin{DoxyCompactList}\small\item\em Test if the scoop has reached eof. \end{DoxyCompactList}\item 
static void $\ast$ \mbox{\hyperlink{scoop_8h_ac67ce8e051fbfa5b65cbaf09f42a5b15}{rs\+\_\+scoop\+\_\+buf}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job)
\begin{DoxyCompactList}\small\item\em Get a pointer to the next input in the scoop. \end{DoxyCompactList}\item 
static size\+\_\+t \mbox{\hyperlink{scoop_8h_aee362de570b50eb6b6c4e9d8f0251208}{rs\+\_\+scoop\+\_\+len}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job)
\begin{DoxyCompactList}\small\item\em Get the contiguous length of the next input in the scoop. \end{DoxyCompactList}\item 
static void $\ast$ \mbox{\hyperlink{scoop_8h_a0e7de2ad29ba6881e1320c5f45e7b023}{rs\+\_\+scoop\+\_\+getbuf}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job, size\+\_\+t $\ast$len)
\begin{DoxyCompactList}\small\item\em Get the next contiguous buffer of data available in the scoop. \end{DoxyCompactList}\item 
static void $\ast$ \mbox{\hyperlink{scoop_8h_ab0599c9d3737912cd1fc5e31bc8664c1}{rs\+\_\+scoop\+\_\+iterbuf}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job, size\+\_\+t $\ast$len, size\+\_\+t $\ast$ilen)
\begin{DoxyCompactList}\small\item\em Iterate through and consume contiguous data buffers in the scoop. \end{DoxyCompactList}\item 
static void $\ast$ \mbox{\hyperlink{scoop_8h_aeee826905a895126adac975f2c3cfc78}{rs\+\_\+scoop\+\_\+nextbuf}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job, size\+\_\+t $\ast$len, size\+\_\+t $\ast$ilen)
\begin{DoxyCompactList}\small\item\em Get the next iteration of contiguous data buffers from the scoop. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsubsection{Detailed Description}
Manage librsync streams of IO. 

See \begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{scoop_8c}{scoop.\+c}} and 

\mbox{\hyperlink{tube_8c}{tube.\+c}} for related code for input and output respectively.
\end{DoxySeeAlso}
OK, so I\textquotesingle{}ll admit IO here is a little complex. The most important player here is the stream, which is an object for managing filter operations. It has both input and output sides, both of which is just a (pointer,len) pair into a buffer provided by the client. The code controlling the stream handles however much data it wants, and the client provides or accepts however much is convenient.

At the same time as being friendly to the client, we also try to be very friendly to the internal code. It wants to be able to ask for arbitrary amounts of input or output and get it without having to keep track of partial completion. So there are functions which either complete, or queue whatever was not sent and return RS\+\_\+\+BLOCKED.

The output buffer is a little more clever than simply a data buffer. Instead it knows that we can send either literal data, or data copied through from the input of the stream.

In \mbox{\hyperlink{buf_8c_source}{buf.\+c}} you will find functions that then map buffers onto stdio files.

On return from an encoding function, some input will have been consumed and/or some output produced, but either the input or the output or possibly both could have some remaining bytes available.

librsync never does IO or memory allocation for stream input, but relies on the caller. This is very nice for integration, but means that we have to be fairly flexible as to when we can `read' or `write' stuff internally.

librsync basically does two types of IO. It reads network integers of various lengths which encode command and control information such as versions and signatures. It also does bulk data transfer.

IO of network integers is internally buffered, because higher levels of the code need to see them transmitted atomically\+: it\textquotesingle{}s no good to read half of a uint32. So there is a small and fixed length internal buffer which accumulates these. Unlike previous versions of the library, we don\textquotesingle{}t require that the caller hold the start until the whole thing has arrived, which guarantees that we can always make progress.

On each call into a stream iterator, it should begin by trying to flush output. This may well use up all the remaining stream space, in which case nothing else can be done. 

Definition in file \mbox{\hyperlink{scoop_8h_source}{scoop.\+h}}.



\doxysubsubsection{Function Documentation}
\mbox{\label{scoop_8h_a5285265e3d220e43b8fd08867d708d9c}} 
\index{scoop.h@{scoop.h}!rs\_tube\_catchup@{rs\_tube\_catchup}}
\index{rs\_tube\_catchup@{rs\_tube\_catchup}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_tube\_catchup()}{rs\_tube\_catchup()}}
{\footnotesize\ttfamily \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} rs\+\_\+tube\+\_\+catchup (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job }\end{DoxyParamCaption})}



Put whatever will fit from the tube into the output of the stream. 

\begin{DoxyReturn}{Returns}
RS\+\_\+\+DONE if the tube is now empty and ready to accept another command, RS\+\_\+\+BLOCKED if there is still stuff waiting to go out. 
\end{DoxyReturn}


Definition at line \mbox{\hyperlink{tube_8c_source_l00120}{120}} of file \mbox{\hyperlink{tube_8c_source}{tube.\+c}}.

\mbox{\label{scoop_8h_afa78a2f17f45a022ec0f93a50c3f142d}} 
\index{scoop.h@{scoop.h}!rs\_tube\_is\_idle@{rs\_tube\_is\_idle}}
\index{rs\_tube\_is\_idle@{rs\_tube\_is\_idle}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_tube\_is\_idle()}{rs\_tube\_is\_idle()}}
{\footnotesize\ttfamily int rs\+\_\+tube\+\_\+is\+\_\+idle (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} const $\ast$}]{job }\end{DoxyParamCaption})}



Definition at line \mbox{\hyperlink{tube_8c_source_l00144}{144}} of file \mbox{\hyperlink{tube_8c_source}{tube.\+c}}.

\mbox{\label{scoop_8h_a98f3b8fcc410948351d62728018ec67d}} 
\index{scoop.h@{scoop.h}!rs\_tube\_write@{rs\_tube\_write}}
\index{rs\_tube\_write@{rs\_tube\_write}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_tube\_write()}{rs\_tube\_write()}}
{\footnotesize\ttfamily void rs\+\_\+tube\+\_\+write (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job,  }\item[{const void $\ast$}]{buf,  }\item[{size\+\_\+t}]{len }\end{DoxyParamCaption})}



Push some data into the tube for storage. 

The tube\textquotesingle{}s never supposed to get very big, so this will just pop loudly if you do that.

We can\textquotesingle{}t accept write data if there\textquotesingle{}s already a copy command in the tube, because the write data comes out first. 

Definition at line \mbox{\hyperlink{tube_8c_source_l00174}{174}} of file \mbox{\hyperlink{tube_8c_source}{tube.\+c}}.

\mbox{\label{scoop_8h_aa1170d5552b5581630f90d8a66a71adc}} 
\index{scoop.h@{scoop.h}!rs\_tube\_copy@{rs\_tube\_copy}}
\index{rs\_tube\_copy@{rs\_tube\_copy}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_tube\_copy()}{rs\_tube\_copy()}}
{\footnotesize\ttfamily void rs\+\_\+tube\+\_\+copy (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job,  }\item[{size\+\_\+t}]{len }\end{DoxyParamCaption})}



Queue up a request to copy through {\ttfamily len} bytes from the input to the output of the stream. 

The data is copied from the scoop (if there is anything there) or from the input, on the next call to \mbox{\hyperlink{tube_8c_a15809106e8f91386fb19f3934f73b993}{rs\+\_\+tube\+\_\+write()}}.

We can only accept this request if there is no copy command already pending.

\begin{DoxyRefDesc}{Todo}
\item[\mbox{\hyperlink{todo__todo000020}{Todo}}]Try to do the copy immediately, and return a result. Then, people can try to continue if possible. Is this really required? Callers can just go out and back in again after flushing the tube. \end{DoxyRefDesc}


Definition at line \mbox{\hyperlink{tube_8c_source_l00160}{160}} of file \mbox{\hyperlink{tube_8c_source}{tube.\+c}}.

\mbox{\label{scoop_8h_aad3e63ccd707266363d6feeca754a370}} 
\index{scoop.h@{scoop.h}!rs\_scoop\_advance@{rs\_scoop\_advance}}
\index{rs\_scoop\_advance@{rs\_scoop\_advance}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_scoop\_advance()}{rs\_scoop\_advance()}}
{\footnotesize\ttfamily void rs\+\_\+scoop\+\_\+advance (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job,  }\item[{size\+\_\+t}]{len }\end{DoxyParamCaption})}



Advance the input cursor forward {\ttfamily len} bytes. 

This is used after doing readahead, when you decide you want to keep it. {\ttfamily len} must be no more than the amount of available data, so you can\textquotesingle{}t cheat.

So when creating a delta, we require one block of readahead. But after examining that block, we might decide to advance over all of it (if there is a match), or just one byte (if not). 

Definition at line \mbox{\hyperlink{scoop_8c_source_l00117}{117}} of file \mbox{\hyperlink{scoop_8c_source}{scoop.\+c}}.

\mbox{\label{scoop_8h_a026b9505478d48f4b9b05fea46c166e1}} 
\index{scoop.h@{scoop.h}!rs\_scoop\_readahead@{rs\_scoop\_readahead}}
\index{rs\_scoop\_readahead@{rs\_scoop\_readahead}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_scoop\_readahead()}{rs\_scoop\_readahead()}}
{\footnotesize\ttfamily \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} rs\+\_\+scoop\+\_\+readahead (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job,  }\item[{size\+\_\+t}]{len,  }\item[{void $\ast$$\ast$}]{ptr }\end{DoxyParamCaption})}



Read from scoop without advancing. 

Ask for LEN bytes of input from the stream. If that much data is available, then return a pointer to it in PTR, advance the stream input pointer over the data, and return RS\+\_\+\+DONE. If there\textquotesingle{}s not enough data, then accept whatever is there into a buffer, advance over it, and return RS\+\_\+\+BLOCKED.

The data is not actually removed from the input, so this function lets you do readahead. If you want to keep any of the data, you should also call \mbox{\hyperlink{scoop_8c_aad3e63ccd707266363d6feeca754a370}{rs\+\_\+scoop\+\_\+advance()}} to skip over it. 

Definition at line \mbox{\hyperlink{scoop_8c_source_l00148}{148}} of file \mbox{\hyperlink{scoop_8c_source}{scoop.\+c}}.

\mbox{\label{scoop_8h_a9eb894edc12cd2972a1eb020bdc80725}} 
\index{scoop.h@{scoop.h}!rs\_scoop\_read@{rs\_scoop\_read}}
\index{rs\_scoop\_read@{rs\_scoop\_read}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_scoop\_read()}{rs\_scoop\_read()}}
{\footnotesize\ttfamily \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} rs\+\_\+scoop\+\_\+read (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job,  }\item[{size\+\_\+t}]{len,  }\item[{void $\ast$$\ast$}]{ptr }\end{DoxyParamCaption})}



Read LEN bytes if possible, and remove them from the input scoop. 


\begin{DoxyParams}{Parameters}
{\em $\ast$job} & An rs\+\_\+job\+\_\+t pointer to the job instance.\\
\hline
{\em len} & The length of the data in the ptr buffer.\\
\hline
{\em $\ast$$\ast$ptr} & will be updated to point to a read-\/only buffer holding the data, if enough is available.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
RS\+\_\+\+DONE if there was enough data, RS\+\_\+\+BLOCKED if there was not enough data yet, or RS\+\_\+\+INPUT\+\_\+\+ENDED if there was not enough data and at EOF. 
\end{DoxyReturn}


Definition at line \mbox{\hyperlink{scoop_8c_source_l00192}{192}} of file \mbox{\hyperlink{scoop_8c_source}{scoop.\+c}}.

\mbox{\label{scoop_8h_af9c1b8a80bbed23d9409559fa101496b}} 
\index{scoop.h@{scoop.h}!rs\_scoop\_read\_rest@{rs\_scoop\_read\_rest}}
\index{rs\_scoop\_read\_rest@{rs\_scoop\_read\_rest}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_scoop\_read\_rest()}{rs\_scoop\_read\_rest()}}
{\footnotesize\ttfamily \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} rs\+\_\+scoop\+\_\+read\+\_\+rest (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job,  }\item[{size\+\_\+t $\ast$}]{len,  }\item[{void $\ast$$\ast$}]{ptr }\end{DoxyParamCaption})}



Read whatever data remains in the input stream. 


\begin{DoxyParams}{Parameters}
{\em $\ast$job} & The rs\+\_\+job\+\_\+t instance the job instance.\\
\hline
{\em $\ast$len} & will be updated to the length of the available data.\\
\hline
{\em $\ast$$\ast$ptr} & will point at the available data.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
RS\+\_\+\+DONE if there was data, RS\+\_\+\+INPUT\+\_\+\+ENDED if there was no data and at EOF, RS\+\_\+\+BLOCKED if there was no data and not at EOF. 
\end{DoxyReturn}


Definition at line \mbox{\hyperlink{scoop_8c_source_l00212}{212}} of file \mbox{\hyperlink{scoop_8c_source}{scoop.\+c}}.

\mbox{\label{scoop_8h_a28ab45a981e0a32d504f9eb3c6155798}} 
\index{scoop.h@{scoop.h}!rs\_scoop\_avail@{rs\_scoop\_avail}}
\index{rs\_scoop\_avail@{rs\_scoop\_avail}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_scoop\_avail()}{rs\_scoop\_avail()}}
{\footnotesize\ttfamily static size\+\_\+t rs\+\_\+scoop\+\_\+avail (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Definition at line \mbox{\hyperlink{scoop_8h_source_l00094}{94}} of file \mbox{\hyperlink{scoop_8h_source}{scoop.\+h}}.

\mbox{\label{scoop_8h_a6eb10b8ed1aa7f16ddf66e2e1051ff85}} 
\index{scoop.h@{scoop.h}!rs\_scoop\_eof@{rs\_scoop\_eof}}
\index{rs\_scoop\_eof@{rs\_scoop\_eof}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_scoop\_eof()}{rs\_scoop\_eof()}}
{\footnotesize\ttfamily static bool rs\+\_\+scoop\+\_\+eof (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Test if the scoop has reached eof. 



Definition at line \mbox{\hyperlink{scoop_8h_source_l00100}{100}} of file \mbox{\hyperlink{scoop_8h_source}{scoop.\+h}}.

\mbox{\label{scoop_8h_ac67ce8e051fbfa5b65cbaf09f42a5b15}} 
\index{scoop.h@{scoop.h}!rs\_scoop\_buf@{rs\_scoop\_buf}}
\index{rs\_scoop\_buf@{rs\_scoop\_buf}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_scoop\_buf()}{rs\_scoop\_buf()}}
{\footnotesize\ttfamily static void $\ast$ rs\+\_\+scoop\+\_\+buf (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Get a pointer to the next input in the scoop. 



Definition at line \mbox{\hyperlink{scoop_8h_source_l00106}{106}} of file \mbox{\hyperlink{scoop_8h_source}{scoop.\+h}}.

\mbox{\label{scoop_8h_aee362de570b50eb6b6c4e9d8f0251208}} 
\index{scoop.h@{scoop.h}!rs\_scoop\_len@{rs\_scoop\_len}}
\index{rs\_scoop\_len@{rs\_scoop\_len}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_scoop\_len()}{rs\_scoop\_len()}}
{\footnotesize\ttfamily static size\+\_\+t rs\+\_\+scoop\+\_\+len (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Get the contiguous length of the next input in the scoop. 



Definition at line \mbox{\hyperlink{scoop_8h_source_l00113}{113}} of file \mbox{\hyperlink{scoop_8h_source}{scoop.\+h}}.

\mbox{\label{scoop_8h_a0e7de2ad29ba6881e1320c5f45e7b023}} 
\index{scoop.h@{scoop.h}!rs\_scoop\_getbuf@{rs\_scoop\_getbuf}}
\index{rs\_scoop\_getbuf@{rs\_scoop\_getbuf}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_scoop\_getbuf()}{rs\_scoop\_getbuf()}}
{\footnotesize\ttfamily static void $\ast$ rs\+\_\+scoop\+\_\+getbuf (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job,  }\item[{size\+\_\+t $\ast$}]{len }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Get the next contiguous buffer of data available in the scoop. 

This will return a pointer to the data and reduce len to the amount of contiguous data available at that position.


\begin{DoxyParams}{Parameters}
{\em $\ast$job} & -\/ the job instance to use.\\
\hline
{\em $\ast$len} & -\/ the amount of data desired, updated to the amount available.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A pointer to the data. 
\end{DoxyReturn}


Definition at line \mbox{\hyperlink{scoop_8h_source_l00128}{128}} of file \mbox{\hyperlink{scoop_8h_source}{scoop.\+h}}.

\mbox{\label{scoop_8h_ab0599c9d3737912cd1fc5e31bc8664c1}} 
\index{scoop.h@{scoop.h}!rs\_scoop\_iterbuf@{rs\_scoop\_iterbuf}}
\index{rs\_scoop\_iterbuf@{rs\_scoop\_iterbuf}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_scoop\_iterbuf()}{rs\_scoop\_iterbuf()}}
{\footnotesize\ttfamily static void $\ast$ rs\+\_\+scoop\+\_\+iterbuf (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job,  }\item[{size\+\_\+t $\ast$}]{len,  }\item[{size\+\_\+t $\ast$}]{ilen }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Iterate through and consume contiguous data buffers in the scoop. 

Example\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordtype}{size\_t} len=rs\_scoop\_avail(job);}
\DoxyCodeLine{\textcolor{keywordtype}{size\_t} ilen;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordflow}{for} (buf = rs\_scoop\_iterbuf(job, \&len, \&ilen); ilen > 0;}
\DoxyCodeLine{     buf = rs\_scoop\_nextbuf(job, \&len, \&ilen))}
\DoxyCodeLine{  ilen = fwrite(buf, ilen, 1, f);}

\end{DoxyCode}


At each iteration buf and ilen are the data and its length for the current iteration, and len is the remaining data to iterate through including the current iteration. During an iteration you can change ilen to indicate only part of the buffer was processed and the next iteration will take this into account. Setting ilen = 0 to indicate blocking or errors will terminate iteration.

At the end of iteration buf will point at the next location in the scoop after the iterated data, len and ilen will be zero, or the remaining data and last ilen if iteration was terminated by setting ilen = 0.


\begin{DoxyParams}{Parameters}
{\em $\ast$job} & -\/ the job instance to use.\\
\hline
{\em $\ast$len} & -\/ the size\+\_\+t amount of data to iterate over.\\
\hline
{\em $\ast$ilen} & -\/ the size\+\_\+t amount of data in the current iteration.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A pointer to data in the current iteration. 
\end{DoxyReturn}


Definition at line \mbox{\hyperlink{scoop_8h_source_l00165}{165}} of file \mbox{\hyperlink{scoop_8h_source}{scoop.\+h}}.

\mbox{\label{scoop_8h_aeee826905a895126adac975f2c3cfc78}} 
\index{scoop.h@{scoop.h}!rs\_scoop\_nextbuf@{rs\_scoop\_nextbuf}}
\index{rs\_scoop\_nextbuf@{rs\_scoop\_nextbuf}!scoop.h@{scoop.h}}
\doxyparagraph{\texorpdfstring{rs\_scoop\_nextbuf()}{rs\_scoop\_nextbuf()}}
{\footnotesize\ttfamily static void $\ast$ rs\+\_\+scoop\+\_\+nextbuf (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job,  }\item[{size\+\_\+t $\ast$}]{len,  }\item[{size\+\_\+t $\ast$}]{ilen }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Get the next iteration of contiguous data buffers from the scoop. 

This advances the scoop for the previous iteration, and gets the next iteration. \begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{scoop_8h_ab0599c9d3737912cd1fc5e31bc8664c1}{rs\+\_\+scoop\+\_\+iterbuf}} 
\end{DoxySeeAlso}


Definition at line \mbox{\hyperlink{scoop_8h_source_l00175}{175}} of file \mbox{\hyperlink{scoop_8h_source}{scoop.\+h}}.

