\hypertarget{BFO_8c}{
\section{BFO.c File Reference}
\label{BFO_8c}\index{BFO.c@{BFO.c}}
}
Balloon Flight Output, Routines. 


{\tt \#include $<$errno.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$sem\-Lib.h$>$}\par
{\tt \#include $<$sock\-Lib.h$>$}\par
{\tt \#include $<$inet\-Lib.h$>$}\par
{\tt \#include $<$sys\-Lib.h$>$}\par
{\tt \#include $<$tick\-Lib.h$>$}\par
{\tt \#include \char`\"{}BBC/BUG.h\char`\"{}}\par
{\tt \#include \char`\"{}BBC/FPA.h\char`\"{}}\par
{\tt \#include \char`\"{}BBC/FORK.h\char`\"{}}\par
{\tt \#include \char`\"{}BBC/RNG.h\char`\"{}}\par
{\tt \#include \char`\"{}BFU/BFA.h\char`\"{}}\par
{\tt \#include \char`\"{}BFU/BFO.h\char`\"{}}\par
{\tt \#include \char`\"{}BFU/BFU\_\-file\-Dsc.h\char`\"{}}\par
{\tt \#include \char`\"{}CCSDS/CCSDS\_\-bfem.h\char`\"{}}\par
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__BFO__biu}{\_\-BFO\_\-biu}
\begin{CompactList}\small\item\em Defines the parameters which control writing a sampled stream of events to the BIU.\item\end{CompactList}\item 
struct \hyperlink{struct__BFO__biuDst}{\_\-BFO\_\-biu\-Dst}
\begin{CompactList}\small\item\em Defines an BIU destination control structure.\item\end{CompactList}\item 
struct \hyperlink{struct__BFO__dsk}{\_\-BFO\_\-dsk}
\begin{CompactList}\small\item\em Defines the parameters which control writing a disk file.\item\end{CompactList}\item 
struct \hyperlink{struct__BFO__msg}{\_\-BFO\_\-msg}
\begin{CompactList}\small\item\em Defines the contents of a message passed between the FORK tasks.\item\end{CompactList}\item 
struct \hyperlink{struct__BFO__ocb}{\_\-BFO\_\-ocb}
\begin{CompactList}\small\item\em The Output Control Block.\item\end{CompactList}\item 
struct \hyperlink{struct__BFO__stats}{\_\-BFO\_\-stats}
\begin{CompactList}\small\item\em Defines an IO statistics block.\item\end{CompactList}\item 
struct \hyperlink{struct__BFO__statsRec}{\_\-BFO\_\-stats\-Rec}
\begin{CompactList}\small\item\em Defines an IO statistics record.\item\end{CompactList}\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{BFO_8c_a0}{
\index{BFO_K_BIU_MAX_PKT_SIZE@{BFO\_\-K\_\-BIU\_\-MAX\_\-PKT\_\-SIZE}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_K_BIU_MAX_PKT_SIZE@{BFO\_\-K\_\-BIU\_\-MAX\_\-PKT\_\-SIZE}}
\#define \hyperlink{BFO_8c_a0}{BFO\_\-K\_\-BIU\_\-MAX\_\-PKT\_\-SIZE}\ 0x8000}
\label{BFO_8c_a0}

\begin{CompactList}\small\item\em Limits the maximum UDP packet.\item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{BFO_8c_a1}{
\index{BFO_msg@{BFO\_\-msg}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_msg@{BFO\_\-msg}}
typedef \hyperlink{struct__BFO__msg}{\_\-BFO\_\-msg} \hyperlink{BFO_8c_a1}{BFO\_\-msg}}
\label{BFO_8c_a1}

\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__BFO__msg}{\_\-BFO\_\-msg}.\item\end{CompactList}\item 
\hypertarget{BFO_8c_a2}{
\index{BFO_dsk@{BFO\_\-dsk}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_dsk@{BFO\_\-dsk}}
typedef \hyperlink{struct__BFO__dsk}{\_\-BFO\_\-dsk} \hyperlink{BFO_8c_a2}{BFO\_\-dsk}}
\label{BFO_8c_a2}

\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__BFO__dsk}{\_\-BFO\_\-dsk}.\item\end{CompactList}\item 
typedef \hyperlink{struct__BFO__statsRec}{\_\-BFO\_\-stats\-Rec} \hyperlink{BFO_8c_a3}{BFO\_\-stats\-Rec}
\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__BFO__statsRec}{\_\-BFO\_\-stats\-Rec}.\item\end{CompactList}\item 
typedef \hyperlink{struct__BFO__stats}{\_\-BFO\_\-stats} \hyperlink{BFO_8c_a4}{BFO\_\-stats}
\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__BFO__stats}{\_\-BFO\_\-stats}.\item\end{CompactList}\item 
typedef \hyperlink{struct__BFO__biuDst}{\_\-BFO\_\-biu\-Dst} \hyperlink{BFO_8c_a5}{BFO\_\-biu\-Dst}
\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__BFO__biuDst}{\_\-BFO\_\-biu\-Dst}.\item\end{CompactList}\item 
\hypertarget{BFO_8c_a6}{
\index{BFO_biu@{BFO\_\-biu}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_biu@{BFO\_\-biu}}
typedef \hyperlink{struct__BFO__biu}{\_\-BFO\_\-biu} \hyperlink{BFO_8c_a6}{BFO\_\-biu}}
\label{BFO_8c_a6}

\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__BFO__biu}{\_\-BFO\_\-biu}.\item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
FORK\_\-cb\_\-status \hyperlink{BFO_8c_a8}{bfo\-Default} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo, \hyperlink{BFO_8c_a1}{BFO\_\-msg} $\ast$msg)
\begin{CompactList}\small\item\em Default Fork task handler.\item\end{CompactList}\item 
FORK\_\-cb\_\-status \hyperlink{BFO_8c_a9}{bfo\-Flush} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo, \hyperlink{BFO_8c_a1}{BFO\_\-msg} $\ast$msg)
\begin{CompactList}\small\item\em Handles a FLUSH request.\item\end{CompactList}\item 
FORK\_\-cb\_\-status \hyperlink{BFO_8c_a10}{bfo\-Synch} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo, \hyperlink{BFO_8c_a1}{BFO\_\-msg} $\ast$msg)
\begin{CompactList}\small\item\em Handles a SYNCH request.\item\end{CompactList}\item 
FORK\_\-cb\_\-status \hyperlink{BFO_8c_a11}{bfo\-Write} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo, \hyperlink{BFO_8c_a1}{BFO\_\-msg} $\ast$msg)
\begin{CompactList}\small\item\em Handles a WRITE request.\item\end{CompactList}\item 
void \hyperlink{BFO_8c_a12}{dsk\-Init} (\hyperlink{BFO_8c_a2}{BFO\_\-dsk} $\ast$dsk, \hyperlink{BFO_8h_a1}{BFO\_\-dsk\-Write\-Rtn} wrt, RNG\_\-rcb $\ast$rcb)
\begin{CompactList}\small\item\em Initializes the disk control structure.\item\end{CompactList}\item 
int \hyperlink{BFO_8c_a13}{dsk\-Write} (\hyperlink{BFO_8c_a2}{BFO\_\-dsk} $\ast$dsk, const char $\ast$ptr, int nbytes)
\begin{CompactList}\small\item\em Controls writing data to disk.\item\end{CompactList}\item 
void \hyperlink{BFO_8c_a14}{biu\-Init} (\hyperlink{BFO_8c_a6}{BFO\_\-biu} $\ast$biu)
\begin{CompactList}\small\item\em Initializes the BFO BIU output control structure.\item\end{CompactList}\item 
int \hyperlink{BFO_8c_a15}{biu\-Write} (\hyperlink{BFO_8c_a6}{BFO\_\-biu} $\ast$biu, \hyperlink{BFU__fileDsc_8h_a2}{BFU\_\-file\-Dsc} $\ast$file\-Dsc)
\begin{CompactList}\small\item\em Evaluates the number of bytes/events that the BIU can absorb and sends them.\item\end{CompactList}\item 
int \hyperlink{BFO_8c_a16}{biu\-Write\-Recs} (\hyperlink{BFO_8c_a5}{BFO\_\-biu\-Dst} $\ast$dst, int nrecs, \hyperlink{BFU__fileDsc_8h_a1}{BFU\_\-rec\-Dsc} $\ast$recs, int inc, int credit)
\begin{CompactList}\small\item\em Evaluates the number of bytes/events that the BIU can absorb and sends them.\item\end{CompactList}\item 
int \hyperlink{BFO_8c_a17}{biu\-Credit\-Calc} (const \hyperlink{BFO_8c_a6}{BFO\_\-biu} $\ast$biu, unsigned int curtime)
\begin{CompactList}\small\item\em Evaluates the number of bytes that the BIU can absorb.\item\end{CompactList}\item 
int \hyperlink{BFO_8c_a18}{biu\-Inc\-Calc} (const \hyperlink{BFU__fileDsc_8h_a2}{BFU\_\-file\-Dsc} $\ast$dsc, int credit)
\begin{CompactList}\small\item\em Makes a guess how many events can be sent.\item\end{CompactList}\item 
\hypertarget{BFO_8c_a19}{
\index{BFO_get@{BFO\_\-get}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_get@{BFO\_\-get}}
\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$ {\bf BFO\_\-get} (void)}
\label{BFO_8c_a19}

\item 
\hypertarget{BFO_8c_a20}{
\index{BFO_ocb_sizeof@{BFO\_\-ocb\_\-sizeof}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_ocb_sizeof@{BFO\_\-ocb\_\-sizeof}}
int {\bf BFO\_\-ocb\_\-sizeof} (void)}
\label{BFO_8c_a20}

\item 
\hypertarget{BFO_8c_a21}{
\index{BFO_msg_sizeof@{BFO\_\-msg\_\-sizeof}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_msg_sizeof@{BFO\_\-msg\_\-sizeof}}
int {\bf BFO\_\-msg\_\-sizeof} (void)}
\label{BFO_8c_a21}

\item 
\hypertarget{BFO_8c_a22}{
\index{BFO_ocb_init@{BFO\_\-ocb\_\-init}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_ocb_init@{BFO\_\-ocb\_\-init}}
int {\bf BFO\_\-ocb\_\-init} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo, \hyperlink{BFO_8h_a1}{BFO\_\-dsk\-Write\-Rtn} wrt, void $\ast$msgs, int msgs\_\-size, struct \hyperlink{struct__BFA__acb}{\_\-BFA\_\-acb} $\ast$acb)}
\label{BFO_8c_a22}

\item 
\hypertarget{BFO_8c_a23}{
\index{BFO_biuDisable@{BFO\_\-biuDisable}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_biuDisable@{BFO\_\-biu\-Disable}}
int {\bf BFO\_\-biu\-Disable} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo)}
\label{BFO_8c_a23}

\item 
\hypertarget{BFO_8c_a24}{
\index{BFO_biuDstSet@{BFO\_\-biuDstSet}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_biuDstSet@{BFO\_\-biu\-Dst\-Set}}
int {\bf BFO\_\-biu\-Dst\-Set} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo, unsigned int ip, unsigned short port)}
\label{BFO_8c_a24}

\item 
\hypertarget{BFO_8c_a25}{
\index{BFO_biuEnable@{BFO\_\-biuEnable}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_biuEnable@{BFO\_\-biu\-Enable}}
int {\bf BFO\_\-biu\-Enable} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo)}
\label{BFO_8c_a25}

\item 
\hypertarget{BFO_8c_a26}{
\index{BFO_biuSamplingSet@{BFO\_\-biuSamplingSet}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_biuSamplingSet@{BFO\_\-biu\-Sampling\-Set}}
void {\bf BFO\_\-biu\-Sampling\-Set} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo, int sample\-Rate, int limit)}
\label{BFO_8c_a26}

\item 
\hypertarget{BFO_8c_a27}{
\index{BFO_dskBlkSizeSet@{BFO\_\-dskBlkSizeSet}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_dskBlkSizeSet@{BFO\_\-dsk\-Blk\-Size\-Set}}
void {\bf BFO\_\-dsk\-Blk\-Size\-Set} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo, int blk\-Size)}
\label{BFO_8c_a27}

\item 
\hypertarget{BFO_8c_a28}{
\index{BFO_dskDisable@{BFO\_\-dskDisable}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_dskDisable@{BFO\_\-dsk\-Disable}}
int {\bf BFO\_\-dsk\-Disable} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo)}
\label{BFO_8c_a28}

\item 
\hypertarget{BFO_8c_a29}{
\index{BFO_dskEnable@{BFO\_\-dskEnable}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_dskEnable@{BFO\_\-dsk\-Enable}}
int {\bf BFO\_\-dsk\-Enable} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo)}
\label{BFO_8c_a29}

\item 
\hypertarget{BFO_8c_a30}{
\index{BFO_dskFileSet@{BFO\_\-dskFileSet}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_dskFileSet@{BFO\_\-dsk\-File\-Set}}
void {\bf BFO\_\-dsk\-File\-Set} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo, int fd)}
\label{BFO_8c_a30}

\item 
\hypertarget{BFO_8c_a31}{
\index{BFO_dskFileGet@{BFO\_\-dskFileGet}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_dskFileGet@{BFO\_\-dsk\-File\-Get}}
int {\bf BFO\_\-dsk\-File\-Get} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo)}
\label{BFO_8c_a31}

\item 
\hypertarget{BFO_8c_a32}{
\index{BFO_write@{BFO\_\-write}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_write@{BFO\_\-write}}
int {\bf BFO\_\-write} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo, struct \hyperlink{struct__BFU__fileDsc}{\_\-BFU\_\-file\-Dsc} $\ast$file\-Dsc)}
\label{BFO_8c_a32}

\item 
\hypertarget{BFO_8c_a33}{
\index{BFO_flush@{BFO\_\-flush}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_flush@{BFO\_\-flush}}
int {\bf BFO\_\-flush} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo)}
\label{BFO_8c_a33}

\item 
\hypertarget{BFO_8c_a34}{
\index{BFO_synch@{BFO\_\-synch}!BFO.c@{BFO.c}}\index{BFO.c@{BFO.c}!BFO_synch@{BFO\_\-synch}}
int {\bf BFO\_\-synch} (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$bfo)}
\label{BFO_8c_a34}

\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$ \hyperlink{BFO_8c_a7}{Bfo\_\-Ocb} = NULL
\begin{CompactList}\small\item\em Internal static for the BFO context block.\item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Balloon Flight Output, Routines.



\begin{Desc}
\item[Author: ]\par
JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}


\subsection{Typedef Documentation}
\hypertarget{BFO_8c_a5}{
\index{BFO.c@{BFO.c}!BFO_biuDst@{BFO\_\-biuDst}}
\index{BFO_biuDst@{BFO\_\-biuDst}!BFO.c@{BFO.c}}
\subsubsection[BFO\_\-biuDst]{\setlength{\rightskip}{0pt plus 5cm}BFO\_\-biu\-Dst}}
\label{BFO_8c_a5}


Typedef for struct \hyperlink{struct__BFO__biuDst}{\_\-BFO\_\-biu\-Dst}.



 \hypertarget{BFO_8c_a4}{
\index{BFO.c@{BFO.c}!BFO_stats@{BFO\_\-stats}}
\index{BFO_stats@{BFO\_\-stats}!BFO.c@{BFO.c}}
\subsubsection[BFO\_\-stats]{\setlength{\rightskip}{0pt plus 5cm}BFO\_\-stats}}
\label{BFO_8c_a4}


Typedef for struct \hyperlink{struct__BFO__stats}{\_\-BFO\_\-stats}.



 An IO statistics block consists of IO statistics records for 3 cateogories of events. \par
 \par
  1. Those events which are too big to send.\par
 2. Those events which were successfully sent.\par
 3. Those events which were encountered an error when sent.\par
 \hypertarget{BFO_8c_a3}{
\index{BFO.c@{BFO.c}!BFO_statsRec@{BFO\_\-statsRec}}
\index{BFO_statsRec@{BFO\_\-statsRec}!BFO.c@{BFO.c}}
\subsubsection[BFO\_\-statsRec]{\setlength{\rightskip}{0pt plus 5cm}BFO\_\-stats\-Rec}}
\label{BFO_8c_a3}


Typedef for struct \hyperlink{struct__BFO__statsRec}{\_\-BFO\_\-stats\-Rec}.



 An IO statistics record keeps track of the number on IOs and the total size of the IOs. 

\subsection{Function Documentation}
\hypertarget{BFO_8c_a8}{
\index{BFO.c@{BFO.c}!bfoDefault@{bfoDefault}}
\index{bfoDefault@{bfoDefault}!BFO.c@{BFO.c}}
\subsubsection[bfoDefault]{\setlength{\rightskip}{0pt plus 5cm}FORK\_\-cb\_\-status bfo\-Default (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$ {\em bfo}, \hyperlink{BFO_8c_a1}{BFO\_\-msg} $\ast$ {\em msg})}}
\label{BFO_8c_a8}


Default Fork task handler.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bfo}]The output context block. \item[{\em 
msg}]The message \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
It BUG checks, since it should never be called.\end{Desc}
This is really a placeholder. No message should ever be dispatched to this routine. \hypertarget{BFO_8c_a9}{
\index{BFO.c@{BFO.c}!bfoFlush@{bfoFlush}}
\index{bfoFlush@{bfoFlush}!BFO.c@{BFO.c}}
\subsubsection[bfoFlush]{\setlength{\rightskip}{0pt plus 5cm}FORK\_\-cb\_\-status bfo\-Flush (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$ {\em bfo}, \hyperlink{BFO_8c_a1}{BFO\_\-msg} $\ast$ {\em msg})}}
\label{BFO_8c_a9}


Handles a FLUSH request.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bfo}]The output context block. \item[{\em 
msg}]The flush message. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
FORK\_\-C\_\-CONTINUE\end{Desc}
A flush operation attempts to move all internally buffered data to the output stream. \hypertarget{BFO_8c_a10}{
\index{BFO.c@{BFO.c}!bfoSynch@{bfoSynch}}
\index{bfoSynch@{bfoSynch}!BFO.c@{BFO.c}}
\subsubsection[bfoSynch]{\setlength{\rightskip}{0pt plus 5cm}FORK\_\-cb\_\-status bfo\-Synch (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$ {\em bfo}, \hyperlink{BFO_8c_a1}{BFO\_\-msg} $\ast$ {\em msg})}}
\label{BFO_8c_a10}


Handles a SYNCH request.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bfo}]The output context block. \item[{\em 
msg}]The synch message. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
FORK\_\-C\_\-CONTINUE\end{Desc}
A synch operation attempts to ensure that the message que is drained, thus guaranteeing that all messages preceeding the synch request have been at least acted upon. \hypertarget{BFO_8c_a11}{
\index{BFO.c@{BFO.c}!bfoWrite@{bfoWrite}}
\index{bfoWrite@{bfoWrite}!BFO.c@{BFO.c}}
\subsubsection[bfoWrite]{\setlength{\rightskip}{0pt plus 5cm}FORK\_\-cb\_\-status bfo\-Write (\hyperlink{BFO_8h_a0}{BFO\_\-ocb} $\ast$ {\em bfo}, \hyperlink{BFO_8c_a1}{BFO\_\-msg} $\ast$ {\em msg})}}
\label{BFO_8c_a11}


Handles a WRITE request.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bfo}]The output context block. \item[{\em 
msg}]The write message. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
FORK\_\-C\_\-CONTINUE\end{Desc}
A write operation makes data available to the output streams. In the case of the BIU, a number of events are sampled from the posted data and immediately transferred to the BIU. In the case of the DISK, data is accumulated in the ring buffer until a cluster size is reached. When sufficient data has accumulated, a write is initialiated. \hypertarget{BFO_8c_a17}{
\index{BFO.c@{BFO.c}!biuCreditCalc@{biuCreditCalc}}
\index{biuCreditCalc@{biuCreditCalc}!BFO.c@{BFO.c}}
\subsubsection[biuCreditCalc]{\setlength{\rightskip}{0pt plus 5cm}int biu\-Credit\-Calc (const \hyperlink{BFO_8c_a6}{BFO\_\-biu} $\ast$ {\em biu}, unsigned int {\em curtime})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFO_8c_a17}


Evaluates the number of bytes that the BIU can absorb.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
biu}]The BIU control structure \item[{\em 
curtime}]The current time. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The number of bytes one is permitted to send.\end{Desc}
The number of bytes that the BIU can absorb is a function of the bytes/sec that are permitted to be sent to the BIU and the elapsed time. The elapsed time is calculated from the time passed in {\em curtime} and the time of the last send. This number is always limited so that one does not accumulate a vast storehouse which would result in bursty behaviour. \hypertarget{BFO_8c_a18}{
\index{BFO.c@{BFO.c}!biuIncCalc@{biuIncCalc}}
\index{biuIncCalc@{biuIncCalc}!BFO.c@{BFO.c}}
\subsubsection[biuIncCalc]{\setlength{\rightskip}{0pt plus 5cm}int biu\-Inc\-Calc (const \hyperlink{BFU__fileDsc_8h_a2}{BFU\_\-file\-Dsc} $\ast$ {\em dsc}, int {\em credit})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFO_8c_a18}


Makes a guess how many events can be sent.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
dsc}]The 'file' descriptor. \item[{\em 
credit}]The number of bytes one can send. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
An integer indicating that one can send every n'th event. \end{Desc}
\hypertarget{BFO_8c_a14}{
\index{BFO.c@{BFO.c}!biuInit@{biuInit}}
\index{biuInit@{biuInit}!BFO.c@{BFO.c}}
\subsubsection[biuInit]{\setlength{\rightskip}{0pt plus 5cm}void biu\-Init (\hyperlink{BFO_8c_a6}{BFO\_\-biu} $\ast$ {\em biu})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFO_8c_a14}


Initializes the BFO BIU output control structure.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
biu}]The BFO BIU structure to initialize.\end{description}
\end{Desc}
Initializes the BFO BIU structure. All members are set to innocous values indicating the structure has been cleared but not yet filled with meaningful values. \hypertarget{BFO_8c_a15}{
\index{BFO.c@{BFO.c}!biuWrite@{biuWrite}}
\index{biuWrite@{biuWrite}!BFO.c@{BFO.c}}
\subsubsection[biuWrite]{\setlength{\rightskip}{0pt plus 5cm}int biu\-Write (\hyperlink{BFO_8c_a6}{BFO\_\-biu} $\ast$ {\em biu}, \hyperlink{BFU__fileDsc_8h_a2}{BFU\_\-file\-Dsc} $\ast$ {\em dsc})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFO_8c_a15}


Evaluates the number of bytes/events that the BIU can absorb and sends them.



 \begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
biu}]The BIU control structure \item[{\em 
dsc}]The event descriptor. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
Status of the write operation \end{Desc}
\hypertarget{BFO_8c_a16}{
\index{BFO.c@{BFO.c}!biuWriteRecs@{biuWriteRecs}}
\index{biuWriteRecs@{biuWriteRecs}!BFO.c@{BFO.c}}
\subsubsection[biuWriteRecs]{\setlength{\rightskip}{0pt plus 5cm}int biu\-Write\-Recs (\hyperlink{BFO_8c_a5}{BFO\_\-biu\-Dst} $\ast$ {\em dst}, int {\em nrecs}, \hyperlink{BFU__fileDsc_8h_a1}{BFU\_\-rec\-Dsc} $\ast$ {\em recs}, int {\em inc}, int {\em credit})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFO_8c_a16}


Evaluates the number of bytes/events that the BIU can absorb and sends them.



 \begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
dst}]The BIU destintation control structure. \item[{\em 
nrecs}]The number of valid records in $\backslash$recs array. \item[{\em 
recs}]An array of {\em nrecs} record descriptors. \item[{\em 
inc}]Every {\em inc} 'th record will be written until the {\em credit} limit is exceeded. \item[{\em 
credit}]The number of bytes that can be written. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The number of unused bytes remaining in the credit limit. \end{Desc}
\hypertarget{BFO_8c_a12}{
\index{BFO.c@{BFO.c}!dskInit@{dskInit}}
\index{dskInit@{dskInit}!BFO.c@{BFO.c}}
\subsubsection[dskInit]{\setlength{\rightskip}{0pt plus 5cm}void dsk\-Init (\hyperlink{BFO_8c_a2}{BFO\_\-dsk} $\ast$ {\em dsk}, \hyperlink{BFO_8h_a1}{BFO\_\-dsk\-Write\-Rtn} {\em wrt}, RNG\_\-rcb $\ast$ {\em rcb})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFO_8c_a12}


Initializes the disk control structure.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
dsk}]The disk control structure to initialize. \item[{\em 
rcb}]The Ring Buffer Control Block which holds the data to be written.\end{description}
\end{Desc}
All members are of the disk control structure are set to innocous values indicating the structure has been cleard, but not yet filled with meaningful values. \hypertarget{BFO_8c_a13}{
\index{BFO.c@{BFO.c}!dskWrite@{dskWrite}}
\index{dskWrite@{dskWrite}!BFO.c@{BFO.c}}
\subsubsection[dskWrite]{\setlength{\rightskip}{0pt plus 5cm}int dsk\-Write (\hyperlink{BFO_8c_a2}{BFO\_\-dsk} $\ast$ {\em dsk}, const char $\ast$ {\em buf}, int {\em nbytes})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFO_8c_a13}


Controls writing data to disk.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
dsk}]The disk control structure \item[{\em 
buf}]Pointer to the buffer to be written to disk \item[{\em 
nbytes}]The number of bytes to be written to disk \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
Status of the write operation.\end{Desc}
Commits the specified number of bytes to be written to disk. If the number of bytes to be written to disk exceeds the disk blocking size, those bytes are written to disk 

\subsection{Variable Documentation}
\hypertarget{BFO_8c_a7}{
\index{BFO.c@{BFO.c}!Bfo_Ocb@{Bfo\_\-Ocb}}
\index{Bfo_Ocb@{Bfo\_\-Ocb}!BFO.c@{BFO.c}}
\subsubsection[Bfo\_\-Ocb]{\setlength{\rightskip}{0pt plus 5cm}Bfo\_\-Ocb = NULL\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BFO_8c_a7}


Internal static for the BFO context block.



 This will be NULL until it has been initialized by BFO\_\-ocb\_\-init () 