\doxysubsection{patch.\+c File Reference}
\label{patch_8c}\index{patch.c@{patch.c}}


Apply a delta to an old file to generate a new file.  


Include dependency graph for patch.\+c\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{patch_8c__incl}
\end{center}
\end{figure}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} \mbox{\hyperlink{patch_8c_a49b37126a6d26a4878417c0330f53482}{rs\+\_\+patch\+\_\+s\+\_\+cmdbyte}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job)
\begin{DoxyCompactList}\small\item\em State of trying to read the first byte of a command. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} \mbox{\hyperlink{patch_8c_a4006a5190618d2ff7d2d9d7ebd7fdec2}{rs\+\_\+patch\+\_\+s\+\_\+params}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job)
\begin{DoxyCompactList}\small\item\em Called after reading a command byte to pull in its parameters and then setup to execute the command. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} \mbox{\hyperlink{patch_8c_a79939cc4d2f205a241baea50823ca36c}{rs\+\_\+patch\+\_\+s\+\_\+run}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job)
\begin{DoxyCompactList}\small\item\em Called when we\textquotesingle{}ve read in the whole command and we need to execute it. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} \mbox{\hyperlink{patch_8c_a22577d87665d023f33e50f04cdbcea60}{rs\+\_\+patch\+\_\+s\+\_\+literal}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job)
\begin{DoxyCompactList}\small\item\em Called when trying to copy through literal data. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} \mbox{\hyperlink{patch_8c_a6a35cd14dc8a3b5424d52d286722670b}{rs\+\_\+patch\+\_\+s\+\_\+copy}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$)
\item 
static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} \mbox{\hyperlink{patch_8c_a4cddc627fec73fc2b16006c23f2acba0}{rs\+\_\+patch\+\_\+s\+\_\+copying}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job)
\begin{DoxyCompactList}\small\item\em Called when we\textquotesingle{}re executing a COPY command and waiting for all the data to be retrieved from the callback. \end{DoxyCompactList}\item 
static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} \mbox{\hyperlink{patch_8c_a688bb47e5b72af9f9867c76c8015d4f7}{rs\+\_\+patch\+\_\+s\+\_\+header}} (\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$job)
\begin{DoxyCompactList}\small\item\em Called while we\textquotesingle{}re trying to read the header of the patch. \end{DoxyCompactList}\item 
\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$ \mbox{\hyperlink{patch_8c_ade8069d04db102aeb75a89e8876bf8fe}{rs\+\_\+patch\+\_\+begin}} (\mbox{\hyperlink{librsync_8h_afc4bc64a627d7ca181a7e813832313cc}{rs\+\_\+copy\+\_\+cb}} $\ast$copy\+\_\+cb, void $\ast$copy\+\_\+arg)
\begin{DoxyCompactList}\small\item\em Apply a {\itshape delta} to a {\itshape basis} file to recreate the {\itshape new} file. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsubsection{Detailed Description}
Apply a delta to an old file to generate a new file. 



Definition in file \mbox{\hyperlink{patch_8c_source}{patch.\+c}}.



\doxysubsubsection{Function Documentation}
\mbox{\label{patch_8c_a49b37126a6d26a4878417c0330f53482}} 
\index{patch.c@{patch.c}!rs\_patch\_s\_cmdbyte@{rs\_patch\_s\_cmdbyte}}
\index{rs\_patch\_s\_cmdbyte@{rs\_patch\_s\_cmdbyte}!patch.c@{patch.c}}
\doxyparagraph{\texorpdfstring{rs\_patch\_s\_cmdbyte()}{rs\_patch\_s\_cmdbyte()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} rs\+\_\+patch\+\_\+s\+\_\+cmdbyte (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



State of trying to read the first byte of a command. 

Once we\textquotesingle{}ve taken that in, we can know how much data to read to get the arguments. 

Definition at line \mbox{\hyperlink{patch_8c_source_l00051}{51}} of file \mbox{\hyperlink{patch_8c_source}{patch.\+c}}.

\mbox{\label{patch_8c_a4006a5190618d2ff7d2d9d7ebd7fdec2}} 
\index{patch.c@{patch.c}!rs\_patch\_s\_params@{rs\_patch\_s\_params}}
\index{rs\_patch\_s\_params@{rs\_patch\_s\_params}!patch.c@{patch.c}}
\doxyparagraph{\texorpdfstring{rs\_patch\_s\_params()}{rs\_patch\_s\_params()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} rs\+\_\+patch\+\_\+s\+\_\+params (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Called after reading a command byte to pull in its parameters and then setup to execute the command. 



Definition at line \mbox{\hyperlink{patch_8c_source_l00071}{71}} of file \mbox{\hyperlink{patch_8c_source}{patch.\+c}}.

\mbox{\label{patch_8c_a79939cc4d2f205a241baea50823ca36c}} 
\index{patch.c@{patch.c}!rs\_patch\_s\_run@{rs\_patch\_s\_run}}
\index{rs\_patch\_s\_run@{rs\_patch\_s\_run}!patch.c@{patch.c}}
\doxyparagraph{\texorpdfstring{rs\_patch\_s\_run()}{rs\_patch\_s\_run()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} rs\+\_\+patch\+\_\+s\+\_\+run (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Called when we\textquotesingle{}ve read in the whole command and we need to execute it. 



Definition at line \mbox{\hyperlink{patch_8c_source_l00094}{94}} of file \mbox{\hyperlink{patch_8c_source}{patch.\+c}}.

\mbox{\label{patch_8c_a22577d87665d023f33e50f04cdbcea60}} 
\index{patch.c@{patch.c}!rs\_patch\_s\_literal@{rs\_patch\_s\_literal}}
\index{rs\_patch\_s\_literal@{rs\_patch\_s\_literal}!patch.c@{patch.c}}
\doxyparagraph{\texorpdfstring{rs\_patch\_s\_literal()}{rs\_patch\_s\_literal()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} rs\+\_\+patch\+\_\+s\+\_\+literal (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Called when trying to copy through literal data. 



Definition at line \mbox{\hyperlink{patch_8c_source_l00114}{114}} of file \mbox{\hyperlink{patch_8c_source}{patch.\+c}}.

\mbox{\label{patch_8c_a6a35cd14dc8a3b5424d52d286722670b}} 
\index{patch.c@{patch.c}!rs\_patch\_s\_copy@{rs\_patch\_s\_copy}}
\index{rs\_patch\_s\_copy@{rs\_patch\_s\_copy}!patch.c@{patch.c}}
\doxyparagraph{\texorpdfstring{rs\_patch\_s\_copy()}{rs\_patch\_s\_copy()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} rs\+\_\+patch\+\_\+s\+\_\+copy (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Definition at line \mbox{\hyperlink{patch_8c_source_l00132}{132}} of file \mbox{\hyperlink{patch_8c_source}{patch.\+c}}.

\mbox{\label{patch_8c_a4cddc627fec73fc2b16006c23f2acba0}} 
\index{patch.c@{patch.c}!rs\_patch\_s\_copying@{rs\_patch\_s\_copying}}
\index{rs\_patch\_s\_copying@{rs\_patch\_s\_copying}!patch.c@{patch.c}}
\doxyparagraph{\texorpdfstring{rs\_patch\_s\_copying()}{rs\_patch\_s\_copying()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} rs\+\_\+patch\+\_\+s\+\_\+copying (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Called when we\textquotesingle{}re executing a COPY command and waiting for all the data to be retrieved from the callback. 



Definition at line \mbox{\hyperlink{patch_8c_source_l00158}{158}} of file \mbox{\hyperlink{patch_8c_source}{patch.\+c}}.

\mbox{\label{patch_8c_a688bb47e5b72af9f9867c76c8015d4f7}} 
\index{patch.c@{patch.c}!rs\_patch\_s\_header@{rs\_patch\_s\_header}}
\index{rs\_patch\_s\_header@{rs\_patch\_s\_header}!patch.c@{patch.c}}
\doxyparagraph{\texorpdfstring{rs\_patch\_s\_header()}{rs\_patch\_s\_header()}}
{\footnotesize\ttfamily static \mbox{\hyperlink{librsync_8h_a7feb858ceba3b8f3cf048d49be108253}{rs\+\_\+result}} rs\+\_\+patch\+\_\+s\+\_\+header (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$}]{job }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Called while we\textquotesingle{}re trying to read the header of the patch. 



Definition at line \mbox{\hyperlink{patch_8c_source_l00204}{204}} of file \mbox{\hyperlink{patch_8c_source}{patch.\+c}}.

\mbox{\label{patch_8c_ade8069d04db102aeb75a89e8876bf8fe}} 
\index{patch.c@{patch.c}!rs\_patch\_begin@{rs\_patch\_begin}}
\index{rs\_patch\_begin@{rs\_patch\_begin}!patch.c@{patch.c}}
\doxyparagraph{\texorpdfstring{rs\_patch\_begin()}{rs\_patch\_begin()}}
{\footnotesize\ttfamily \mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} $\ast$ rs\+\_\+patch\+\_\+begin (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{librsync_8h_afc4bc64a627d7ca181a7e813832313cc}{rs\+\_\+copy\+\_\+cb}} $\ast$}]{copy\+\_\+cb,  }\item[{void $\ast$}]{copy\+\_\+arg }\end{DoxyParamCaption})}



Apply a {\itshape delta} to a {\itshape basis} file to recreate the {\itshape new} file. 

This gives you back a \mbox{\hyperlink{librsync_8h_add6622b38e3fa557301a190876d5ed4a}{rs\+\_\+job\+\_\+t}} object, which can be cranked by calling \mbox{\hyperlink{librsync_8h_aede8e0f42424b9aa29093f94b59ea029}{rs\+\_\+job\+\_\+iter()}} and updating the stream pointers. When finished, call \mbox{\hyperlink{librsync_8h_a297b5522990715aff982f8556052c273}{rs\+\_\+job\+\_\+free()}} to dispose of it.


\begin{DoxyParams}{Parameters}
{\em copy\+\_\+cb} & Callback used to retrieve content from the basis file.\\
\hline
{\em copy\+\_\+arg} & Opaque environment pointer passed through to the callback.\\
\hline
\end{DoxyParams}
\begin{DoxyRefDesc}{Todo}
\item[\mbox{\hyperlink{todo__todo000005}{Todo}}]As output is produced, accumulate the MD4 checksum of the output. Then if we find a CHECKSUM command we can check it\textquotesingle{}s contents against the output.\end{DoxyRefDesc}


\begin{DoxyRefDesc}{Todo}
\item[\mbox{\hyperlink{todo__todo000006}{Todo}}]Implement COPY commands.\end{DoxyRefDesc}


\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{librsync_8h_a76f5d5851aaad2c17bfd9256e344626d}{rs\+\_\+patch\+\_\+file()}} 

\mbox{\hyperlink{api_streaming}{Streaming API}} 
\end{DoxySeeAlso}


Definition at line \mbox{\hyperlink{patch_8c_source_l00221}{221}} of file \mbox{\hyperlink{patch_8c_source}{patch.\+c}}.

