\hypertarget{siis2moc_8c}{
\section{siis2moc.c File Reference}
\label{siis2moc_8c}\index{siis2moc.c@{siis2moc.c}}
}
Convert a SIIS archive file to MOC level 0 files.  


{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$time.h$>$}\par
{\tt \#include \char`\"{}CCSDS/CCSDS\_\-pkt.h\char`\"{}}\par
{\tt \#include \char`\"{}CCSDS/CCSDS\_\-pri.h\char`\"{}}\par
{\tt \#include \char`\"{}MSG/MSG\_\-pubdefs.h\char`\"{}}\par
{\tt \#include \char`\"{}MSG/MSG\_\-printProc.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/TASK.h\char`\"{}}\par
{\tt \#include \char`\"{}SIIS/SIIS\_\-file.h\char`\"{}}\par
{\tt \#include \char`\"{}SIIS/SIIS\_\-moc.h\char`\"{}}\par
{\tt \#include \char`\"{}SIIS/SIIS\_\-rec.h\char`\"{}}\par
{\tt \#include \char`\"{}SIIS/SIIS\_\-vcdu.h\char`\"{}}\par
\subsection*{Classes}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__Apid__Info}{\_\-Apid\_\-Info}
\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{siis2moc_8c_ff22deae578ee689624dcd0d8ce55223}{GLAST\_\-ID}~251
\item 
\#define \hyperlink{siis2moc_8c_3cd6b7e9d8bf36acee07edeb6a94c9f2}{DIM}(a)~(sizeof (a) / sizeof ($\ast$a))
\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef struct \hyperlink{struct__Apid__Info}{\_\-Apid\_\-Info} \hyperlink{siis2moc_8c_a20e9d2e2683381305d261423965c505}{Apid\_\-Info}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
static unsigned int \hyperlink{siis2moc_8c_fa2af54161ebd3b8cb38e58e530de4c0}{find\_\-apid\_\-entry} (\hyperlink{struct__Apid__Info}{Apid\_\-Info} $\ast$$\ast$apid\_\-info\_\-p, const unsigned short apid, const unsigned short vcid)
\item 
static unsigned int \hyperlink{siis2moc_8c_a16ca2861eda73af46a271131002b7a9}{add\_\-apid\_\-entry} (\hyperlink{struct__Apid__Info}{Apid\_\-Info} $\ast$$\ast$apid\_\-info\_\-p, const unsigned short apid, const unsigned short vcid)
\item 
static unsigned int \hyperlink{siis2moc_8c_54009820adf261fdf2bbf97064fb63fe}{parse\_\-command\_\-line} (int argc, char $\ast$argv\mbox{[}$\,$\mbox{]})
\begin{CompactList}\small\item\em Interpret the command line parameters. \item\end{CompactList}\item 
void \hyperlink{siis2moc_8c_f9cfeecbccb39de03a0d017d71c8e4af}{print\_\-message} (MSG\_\-OutputModes mode, void $\ast$prm, const MSG\_\-Message $\ast$msg)
\begin{CompactList}\small\item\em Output processor callback routine to print messages. \item\end{CompactList}\item 
static unsigned int \hyperlink{siis2moc_8c_4dfbc39bb1af308cb4e8a47df3eeea34}{start\_\-message\_\-system} (void)
\item 
static unsigned int \hyperlink{siis2moc_8c_8a496935458c894673aef04c95c4a737}{stop\_\-message\_\-system} (void)
\item 
static unsigned int \hyperlink{siis2moc_8c_cf053f577806f0a62a1120866cf18bdd}{skip\_\-file\_\-data} (FILE $\ast$in\_\-file, const unsigned int num\_\-bytes)
\item 
static unsigned int \hyperlink{siis2moc_8c_07c3d0cfd56684c6f13dfff03b34136c}{create\_\-moc\_\-file} (\hyperlink{struct__Apid__Info}{Apid\_\-Info} $\ast$apid\_\-info, const \hyperlink{struct__SIIS__Pdu__Hdr}{SIIS\_\-Pdu\_\-Hdr} $\ast$pdu\_\-hdr)
\item 
static unsigned int \hyperlink{siis2moc_8c_70cc1cb351018840a09fb8a90ed162cd}{get\_\-apid\_\-info} (\hyperlink{struct__Apid__Info}{Apid\_\-Info} $\ast$$\ast$apid\_\-info\_\-p, const \hyperlink{struct__SIIS__Pdu__Hdr}{SIIS\_\-Pdu\_\-Hdr} $\ast$pdu\_\-hdr, const unsigned short apid)
\item 
static unsigned int \hyperlink{siis2moc_8c_cc0c6346a986624ce51c04da8bab50be}{close\_\-moc\_\-files} (void)
\item 
static unsigned int \hyperlink{siis2moc_8c_3ebde7a7c5202ef76b8659320ffe0b96}{gather\_\-pdu\_\-header} (\hyperlink{struct__SIIS__Pdu__Hdr}{SIIS\_\-Pdu\_\-Hdr} $\ast$pdu\_\-hdr, const unsigned int vcdu\_\-status, const unsigned int time\_\-tag, const \hyperlink{struct__SIIS__Vcdu__Hdr}{SIIS\_\-Vcdu\_\-Hdr} $\ast$vcdu\_\-hdr)
\item 
static unsigned int \hyperlink{siis2moc_8c_8fbde7f3c57397288bd37fb72c66c148}{parse\_\-ccsds\_\-header} (const unsigned char $\ast$data, const unsigned int data\_\-bytes, unsigned short $\ast$type, unsigned short $\ast$apid, unsigned short $\ast$length)
\item 
static unsigned int \hyperlink{siis2moc_8c_eb9375542481b6fcaa9c0d0184605b1d}{write\_\-ccsds\_\-packet} (\hyperlink{struct__SIIS__Pdu__Hdr}{SIIS\_\-Pdu\_\-Hdr} $\ast$pdu\_\-hdr, const unsigned char $\ast$data, const unsigned int data\_\-bytes, const unsigned short apid, const unsigned short length)
\item 
static unsigned int \hyperlink{siis2moc_8c_5312730df2d1e1f49362642d1042ec83}{extract\_\-ccsds\_\-packets} (\hyperlink{struct__SIIS__Pdu__Hdr}{SIIS\_\-Pdu\_\-Hdr} $\ast$pdu\_\-hdr, const unsigned char $\ast$data, unsigned int data\_\-bytes)
\item 
static unsigned int \hyperlink{siis2moc_8c_7db83f1007c80842aad0f8140b39148b}{process\_\-raw\_\-telem} (const unsigned char $\ast$body, const unsigned int body\_\-bytes, const unsigned int time\_\-tag)
\item 
unsigned int \hyperlink{siis2moc_8c_bf062cd7431cf49ac454d58743395918}{process\_\-record} (FILE $\ast$in\_\-file)
\item 
int \hyperlink{siis2moc_8c_0ddf1224851353fc92bfbff6f499fa97}{main} (int argc, char $\ast$argv\mbox{[}$\,$\mbox{]})
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
\hypertarget{siis2moc_8c_b8afcb335d5879651b0329032e1cff7b}{
static char $\ast$ \hyperlink{siis2moc_8c_b8afcb335d5879651b0329032e1cff7b}{In\_\-File\_\-Name}}
\label{siis2moc_8c_b8afcb335d5879651b0329032e1cff7b}

\begin{CompactList}\small\item\em Pointer to the name of the input file. \item\end{CompactList}\item 
\hypertarget{siis2moc_8c_8bbc7dfdc6e84772915f75d1457806a0}{
static int \hyperlink{siis2moc_8c_8bbc7dfdc6e84772915f75d1457806a0}{Include\_\-All}}
\label{siis2moc_8c_8bbc7dfdc6e84772915f75d1457806a0}

\begin{CompactList}\small\item\em Indicates whether we're including all APIDs. \item\end{CompactList}\item 
\hypertarget{siis2moc_8c_478f61c859525f5623a1c67a93580695}{
static int \hyperlink{siis2moc_8c_478f61c859525f5623a1c67a93580695}{Frame\_\-Count} = 0}
\label{siis2moc_8c_478f61c859525f5623a1c67a93580695}

\begin{CompactList}\small\item\em Number of VCDU frames processed. \item\end{CompactList}\item 
\hypertarget{siis2moc_8c_f945bc055af0bee34c42a69f87c491fa}{
static int \hyperlink{siis2moc_8c_f945bc055af0bee34c42a69f87c491fa}{Packet\_\-Read\_\-Count} = 0}
\label{siis2moc_8c_f945bc055af0bee34c42a69f87c491fa}

\begin{CompactList}\small\item\em Number of CCSDS packets read. \item\end{CompactList}\item 
\hypertarget{siis2moc_8c_2966108642839aacef339e4cf6b79420}{
static int \hyperlink{siis2moc_8c_2966108642839aacef339e4cf6b79420}{Packet\_\-Write\_\-Count} = 0}
\label{siis2moc_8c_2966108642839aacef339e4cf6b79420}

\begin{CompactList}\small\item\em Number of CCSDS packets written. \item\end{CompactList}\item 
\hypertarget{siis2moc_8c_17452cfc2e46623da85b9f356b4df137}{
static int \hyperlink{siis2moc_8c_17452cfc2e46623da85b9f356b4df137}{Apid\_\-Count} = 0}
\label{siis2moc_8c_17452cfc2e46623da85b9f356b4df137}

\begin{CompactList}\small\item\em Number of different APIDs found. \item\end{CompactList}\item 
\hypertarget{siis2moc_8c_64fd5165ff5ff1b8ad7967f3a24cffec}{
static \hyperlink{struct__Apid__Info}{Apid\_\-Info} \hyperlink{siis2moc_8c_64fd5165ff5ff1b8ad7967f3a24cffec}{Apid\_\-Vcid} \mbox{[}32\mbox{]} = \{ \{ 0 \} \}}
\label{siis2moc_8c_64fd5165ff5ff1b8ad7967f3a24cffec}

\begin{CompactList}\small\item\em Table of APID/VCIDs found in the archive file. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Convert a SIIS archive file to MOC level 0 files. 



\footnotesize\begin{verbatim}
  CVS $Id: siis2moc.c,v 1.3 2004/12/02 17:52:51 dmay Exp $
  \end{verbatim}
\normalsize


Extract CCSDS packets from a SIIS archive file and write them to level 0 MOC files. 

\subsection{Define Documentation}
\hypertarget{siis2moc_8c_3cd6b7e9d8bf36acee07edeb6a94c9f2}{
\index{siis2moc.c@{siis2moc.c}!DIM@{DIM}}
\index{DIM@{DIM}!siis2moc.c@{siis2moc.c}}
\subsubsection[{DIM}]{\setlength{\rightskip}{0pt plus 5cm}\#define DIM(a)~(sizeof (a) / sizeof ($\ast$a))}}
\label{siis2moc_8c_3cd6b7e9d8bf36acee07edeb6a94c9f2}


Calculate the number of items in an array. 

Referenced by add\_\-apid\_\-entry(), close\_\-moc\_\-files(), find\_\-apid\_\-entry(), and main().\hypertarget{siis2moc_8c_ff22deae578ee689624dcd0d8ce55223}{
\index{siis2moc.c@{siis2moc.c}!GLAST\_\-ID@{GLAST\_\-ID}}
\index{GLAST\_\-ID@{GLAST\_\-ID}!siis2moc.c@{siis2moc.c}}
\subsubsection[{GLAST\_\-ID}]{\setlength{\rightskip}{0pt plus 5cm}\#define GLAST\_\-ID~251}}
\label{siis2moc_8c_ff22deae578ee689624dcd0d8ce55223}


Spacecraft ID for GLAST 

Referenced by gather\_\-pdu\_\-header().

\subsection{Typedef Documentation}
\hypertarget{siis2moc_8c_a20e9d2e2683381305d261423965c505}{
\index{siis2moc.c@{siis2moc.c}!Apid\_\-Info@{Apid\_\-Info}}
\index{Apid\_\-Info@{Apid\_\-Info}!siis2moc.c@{siis2moc.c}}
\subsubsection[{Apid\_\-Info}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Apid\_\-Info}}}
\label{siis2moc_8c_a20e9d2e2683381305d261423965c505}


The typedef for \hyperlink{struct__Apid__Info}{\_\-Apid\_\-Info} 

\subsection{Function Documentation}
\hypertarget{siis2moc_8c_a16ca2861eda73af46a271131002b7a9}{
\index{siis2moc.c@{siis2moc.c}!add\_\-apid\_\-entry@{add\_\-apid\_\-entry}}
\index{add\_\-apid\_\-entry@{add\_\-apid\_\-entry}!siis2moc.c@{siis2moc.c}}
\subsubsection[{add\_\-apid\_\-entry}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int add\_\-apid\_\-entry ({\bf Apid\_\-Info} $\ast$$\ast$ {\em apid\_\-info\_\-p}, \/  const unsigned short {\em apid}, \/  const unsigned short {\em vcid})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_a16ca2861eda73af46a271131002b7a9}


Add a new entry in the APID/VCID table for a particular APID and VCID.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em apid\_\-info\_\-p}]Pointer to location to store entry pointer. \item[{\em apid}]APID for the packet. \item[{\em vcid}]VCID for the packet.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


References \_\-Apid\_\-Info::apid, DIM, \_\-Apid\_\-Info::exclude, \_\-Apid\_\-Info::moc\_\-file, \_\-Apid\_\-Info::read\_\-count, \_\-Apid\_\-Info::seq\_\-num, \_\-Apid\_\-Info::valid, \_\-Apid\_\-Info::vcid, and \_\-Apid\_\-Info::write\_\-count.

Referenced by get\_\-apid\_\-info(), and parse\_\-command\_\-line().\hypertarget{siis2moc_8c_cc0c6346a986624ce51c04da8bab50be}{
\index{siis2moc.c@{siis2moc.c}!close\_\-moc\_\-files@{close\_\-moc\_\-files}}
\index{close\_\-moc\_\-files@{close\_\-moc\_\-files}!siis2moc.c@{siis2moc.c}}
\subsubsection[{close\_\-moc\_\-files}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int close\_\-moc\_\-files (void)\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_cc0c6346a986624ce51c04da8bab50be}


Close all level 0 MOC files that have been created.

\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


References DIM.

Referenced by main().\hypertarget{siis2moc_8c_07c3d0cfd56684c6f13dfff03b34136c}{
\index{siis2moc.c@{siis2moc.c}!create\_\-moc\_\-file@{create\_\-moc\_\-file}}
\index{create\_\-moc\_\-file@{create\_\-moc\_\-file}!siis2moc.c@{siis2moc.c}}
\subsubsection[{create\_\-moc\_\-file}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int create\_\-moc\_\-file ({\bf Apid\_\-Info} $\ast$ {\em apid\_\-info}, \/  const {\bf SIIS\_\-Pdu\_\-Hdr} $\ast$ {\em pdu\_\-hdr})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_07c3d0cfd56684c6f13dfff03b34136c}


Create a level 0 MOC file for a CCSDS packet.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em apid\_\-info}]Pointer to APID/VCID table entry. \item[{\em pdu\_\-hdr}]Pointer to packet annotation header information.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


References \_\-Apid\_\-Info::apid, \_\-Apid\_\-Info::moc\_\-file, \_\-SIIS\_\-Pdu\_\-Hdr::rcv\_\-time\_\-hi, and \_\-Apid\_\-Info::vcid.

Referenced by get\_\-apid\_\-info().\hypertarget{siis2moc_8c_5312730df2d1e1f49362642d1042ec83}{
\index{siis2moc.c@{siis2moc.c}!extract\_\-ccsds\_\-packets@{extract\_\-ccsds\_\-packets}}
\index{extract\_\-ccsds\_\-packets@{extract\_\-ccsds\_\-packets}!siis2moc.c@{siis2moc.c}}
\subsubsection[{extract\_\-ccsds\_\-packets}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int extract\_\-ccsds\_\-packets ({\bf SIIS\_\-Pdu\_\-Hdr} $\ast$ {\em pdu\_\-hdr}, \/  const unsigned char $\ast$ {\em data}, \/  unsigned int {\em data\_\-bytes})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_5312730df2d1e1f49362642d1042ec83}


Extract the CCSDS packets from within a VCDU frame and store them in MOC level 0 files.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em pdu\_\-hdr}]Pointer to packet annotation header info. \item[{\em data}]Pointer to start of the VCDU frame data unit zone. \item[{\em data\_\-bytes}]Number of bytes of data within the data unit zone.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


References parse\_\-ccsds\_\-header(), and write\_\-ccsds\_\-packet().

Referenced by process\_\-raw\_\-telem().\hypertarget{siis2moc_8c_fa2af54161ebd3b8cb38e58e530de4c0}{
\index{siis2moc.c@{siis2moc.c}!find\_\-apid\_\-entry@{find\_\-apid\_\-entry}}
\index{find\_\-apid\_\-entry@{find\_\-apid\_\-entry}!siis2moc.c@{siis2moc.c}}
\subsubsection[{find\_\-apid\_\-entry}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int find\_\-apid\_\-entry ({\bf Apid\_\-Info} $\ast$$\ast$ {\em apid\_\-info\_\-p}, \/  const unsigned short {\em apid}, \/  const unsigned short {\em vcid})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_fa2af54161ebd3b8cb38e58e530de4c0}


Find an entry in the APID/VCID table for a particular APID and VCID.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em apid\_\-info\_\-p}]Pointer to location to store entry pointer. \item[{\em apid}]APID for the packet. \item[{\em vcid}]VCID for the packet.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


References DIM, and \_\-Apid\_\-Info::vcid.

Referenced by get\_\-apid\_\-info(), and parse\_\-command\_\-line().\hypertarget{siis2moc_8c_3ebde7a7c5202ef76b8659320ffe0b96}{
\index{siis2moc.c@{siis2moc.c}!gather\_\-pdu\_\-header@{gather\_\-pdu\_\-header}}
\index{gather\_\-pdu\_\-header@{gather\_\-pdu\_\-header}!siis2moc.c@{siis2moc.c}}
\subsubsection[{gather\_\-pdu\_\-header}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int gather\_\-pdu\_\-header ({\bf SIIS\_\-Pdu\_\-Hdr} $\ast$ {\em pdu\_\-hdr}, \/  const unsigned int {\em vcdu\_\-status}, \/  const unsigned int {\em time\_\-tag}, \/  const {\bf SIIS\_\-Vcdu\_\-Hdr} $\ast$ {\em vcdu\_\-hdr})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_3ebde7a7c5202ef76b8659320ffe0b96}


Gather information that will be stored in a packet annotation header.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em pdu\_\-hdr}]Pointer to location to store annotation header info. \item[{\em vcdu\_\-status}]Status from SIIS\_\-vcduGetHdr. \item[{\em time\_\-tag}]Time at which record was written to archive file. \item[{\em vcdu\_\-hdr}]Pointer to VCDU header info for this frame.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


References \_\-SIIS\_\-Vcdu\_\-Hdr::chan\_\-count, \_\-SIIS\_\-Vcdu\_\-Hdr::channel, \_\-SIIS\_\-Pdu\_\-Hdr::frame\_\-channel, \_\-SIIS\_\-Pdu\_\-Hdr::frame\_\-hdr\_\-error, \_\-SIIS\_\-Pdu\_\-Hdr::frame\_\-seq\_\-error, \_\-SIIS\_\-Pdu\_\-Hdr::frame\_\-spacecraft, \_\-SIIS\_\-Pdu\_\-Hdr::frame\_\-version, GLAST\_\-ID, \_\-SIIS\_\-Pdu\_\-Hdr::rcv\_\-time\_\-hi, \_\-SIIS\_\-Vcdu\_\-Hdr::spacecraft, and \_\-SIIS\_\-Vcdu\_\-Hdr::version.

Referenced by process\_\-raw\_\-telem().\hypertarget{siis2moc_8c_70cc1cb351018840a09fb8a90ed162cd}{
\index{siis2moc.c@{siis2moc.c}!get\_\-apid\_\-info@{get\_\-apid\_\-info}}
\index{get\_\-apid\_\-info@{get\_\-apid\_\-info}!siis2moc.c@{siis2moc.c}}
\subsubsection[{get\_\-apid\_\-info}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int get\_\-apid\_\-info ({\bf Apid\_\-Info} $\ast$$\ast$ {\em apid\_\-info\_\-p}, \/  const {\bf SIIS\_\-Pdu\_\-Hdr} $\ast$ {\em pdu\_\-hdr}, \/  const unsigned short {\em apid})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_70cc1cb351018840a09fb8a90ed162cd}


Find the entry in the APID/VCID table for a particular APID and VCID. If there is no entry, then create a new entry and a new level 0 MOC file.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em apid\_\-info\_\-p}]Pointer to location to store entry pointer. \item[{\em pdu\_\-hdr}]Pointer to packet annotation header information. \item[{\em apid}]APID for the packet.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


References add\_\-apid\_\-entry(), create\_\-moc\_\-file(), find\_\-apid\_\-entry(), \_\-SIIS\_\-Pdu\_\-Hdr::frame\_\-channel, and Include\_\-All.

Referenced by write\_\-ccsds\_\-packet().\hypertarget{siis2moc_8c_0ddf1224851353fc92bfbff6f499fa97}{
\index{siis2moc.c@{siis2moc.c}!main@{main}}
\index{main@{main}!siis2moc.c@{siis2moc.c}}
\subsubsection[{main}]{\setlength{\rightskip}{0pt plus 5cm}int main (int {\em argc}, \/  char $\ast$ {\em argv}\mbox{[}$\,$\mbox{]})}}
\label{siis2moc_8c_0ddf1224851353fc92bfbff6f499fa97}


The application entry point.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em argc}]The number of command line args. \item[{\em argv}]The list of command line args.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]Success. \item[{\em -1}]Failure. \end{description}
\end{Desc}


References Apid\_\-Count, close\_\-moc\_\-files(), DIM, Frame\_\-Count, In\_\-File\_\-Name, Packet\_\-Read\_\-Count, Packet\_\-Write\_\-Count, parse\_\-command\_\-line(), process\_\-record(), SIIS\_\-fileHdrSizeof(), skip\_\-file\_\-data(), start\_\-message\_\-system(), and stop\_\-message\_\-system().\hypertarget{siis2moc_8c_8fbde7f3c57397288bd37fb72c66c148}{
\index{siis2moc.c@{siis2moc.c}!parse\_\-ccsds\_\-header@{parse\_\-ccsds\_\-header}}
\index{parse\_\-ccsds\_\-header@{parse\_\-ccsds\_\-header}!siis2moc.c@{siis2moc.c}}
\subsubsection[{parse\_\-ccsds\_\-header}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int parse\_\-ccsds\_\-header (const unsigned char $\ast$ {\em data}, \/  const unsigned int {\em data\_\-bytes}, \/  unsigned short $\ast$ {\em type}, \/  unsigned short $\ast$ {\em apid}, \/  unsigned short $\ast$ {\em length})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_8fbde7f3c57397288bd37fb72c66c148}


Extract information from the header of a CCSDS packet. Note that the 'length' value includes the length of the packet header.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]Pointer to start of the packet buffer. \item[{\em data\_\-bytes}]Number of bytes of data in the packet buffer. \item[{\em type}]Pointer to location to return packet type. \item[{\em apid}]Pointer to location to return packet APID. \item[{\em length}]Pointer to location to return packet length.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


References Packet\_\-Read\_\-Count.

Referenced by extract\_\-ccsds\_\-packets().\hypertarget{siis2moc_8c_54009820adf261fdf2bbf97064fb63fe}{
\index{siis2moc.c@{siis2moc.c}!parse\_\-command\_\-line@{parse\_\-command\_\-line}}
\index{parse\_\-command\_\-line@{parse\_\-command\_\-line}!siis2moc.c@{siis2moc.c}}
\subsubsection[{parse\_\-command\_\-line}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int parse\_\-command\_\-line (int {\em argc}, \/  char $\ast$ {\em argv}\mbox{[}$\,$\mbox{]})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_54009820adf261fdf2bbf97064fb63fe}


Interpret the command line parameters. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em argc}]The number of command line args. \item[{\em argv}]The list of command line args.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


References add\_\-apid\_\-entry(), \_\-Apid\_\-Info::exclude, find\_\-apid\_\-entry(), In\_\-File\_\-Name, and Include\_\-All.

Referenced by main().\hypertarget{siis2moc_8c_f9cfeecbccb39de03a0d017d71c8e4af}{
\index{siis2moc.c@{siis2moc.c}!print\_\-message@{print\_\-message}}
\index{print\_\-message@{print\_\-message}!siis2moc.c@{siis2moc.c}}
\subsubsection[{print\_\-message}]{\setlength{\rightskip}{0pt plus 5cm}void print\_\-message (MSG\_\-OutputModes {\em mode}, \/  void $\ast$ {\em prm}, \/  const MSG\_\-Message $\ast$ {\em msg})}}
\label{siis2moc_8c_f9cfeecbccb39de03a0d017d71c8e4af}


Output processor callback routine to print messages. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em mode}](in) Output processor calling mode \item[{\em prm}](in) User parameter \item[{\em msg}](in) Message structure\end{description}
\end{Desc}
Prints a message using {\tt printf}. 

Referenced by start\_\-message\_\-system().\hypertarget{siis2moc_8c_7db83f1007c80842aad0f8140b39148b}{
\index{siis2moc.c@{siis2moc.c}!process\_\-raw\_\-telem@{process\_\-raw\_\-telem}}
\index{process\_\-raw\_\-telem@{process\_\-raw\_\-telem}!siis2moc.c@{siis2moc.c}}
\subsubsection[{process\_\-raw\_\-telem}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int process\_\-raw\_\-telem (const unsigned char $\ast$ {\em body}, \/  const unsigned int {\em body\_\-bytes}, \/  const unsigned int {\em time\_\-tag})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_7db83f1007c80842aad0f8140b39148b}


Process a raw telemetry record from the SIIS archive file. For each CCSDS packet within the record, add a packet annotation header to it and store it into a level 0 MOC file.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em body}]Pointer to body of the record. \item[{\em body\_\-bytes}]Number of bytes of data within the record body. \item[{\em time\_\-tag}]Time at which record was written to archive file.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


References \_\-SIIS\_\-Vcdu\_\-Hdr::channel, \_\-SIIS\_\-Vcdu\_\-Hdr::data\_\-offset, extract\_\-ccsds\_\-packets(), \_\-SIIS\_\-Rec\_\-Raw\_\-Telem::frame\_\-bytes, Frame\_\-Count, \_\-SIIS\_\-Rec\_\-Raw\_\-Telem::frame\_\-offset, gather\_\-pdu\_\-header(), SIIS\_\-recGetRawTelem(), SIIS\_\-vcduGetHdr(), and SIIS\_\-vcduTrlSizeof().

Referenced by process\_\-record().\hypertarget{siis2moc_8c_bf062cd7431cf49ac454d58743395918}{
\index{siis2moc.c@{siis2moc.c}!process\_\-record@{process\_\-record}}
\index{process\_\-record@{process\_\-record}!siis2moc.c@{siis2moc.c}}
\subsubsection[{process\_\-record}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int process\_\-record (FILE $\ast$ {\em in\_\-file})}}
\label{siis2moc_8c_bf062cd7431cf49ac454d58743395918}


Process a record from the SIIS archive file. Do nothing with the record unless it is a raw telemetry record. For raw telemetry records, extract the CCSDS packets and store them in MOC level 0 files.

When finished, the file position indicator for in\_\-file will point to the start of the next record within the archive file.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in\_\-file}]Archive file handle.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


References \_\-SIIS\_\-Rec\_\-Hdr::body\_\-bytes, process\_\-raw\_\-telem(), SIIS\_\-REC\_\-TYPE\_\-RAW\_\-TELEM, SIIS\_\-recGetHdr(), SIIS\_\-recHdrSizeof(), SIIS\_\-recTrlSizeof(), skip\_\-file\_\-data(), \_\-SIIS\_\-Rec\_\-Hdr::time\_\-tag, and \_\-SIIS\_\-Rec\_\-Hdr::type.

Referenced by main().\hypertarget{siis2moc_8c_cf053f577806f0a62a1120866cf18bdd}{
\index{siis2moc.c@{siis2moc.c}!skip\_\-file\_\-data@{skip\_\-file\_\-data}}
\index{skip\_\-file\_\-data@{skip\_\-file\_\-data}!siis2moc.c@{siis2moc.c}}
\subsubsection[{skip\_\-file\_\-data}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int skip\_\-file\_\-data (FILE $\ast$ {\em in\_\-file}, \/  const unsigned int {\em num\_\-bytes})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_cf053f577806f0a62a1120866cf18bdd}


Read and discard data from a file.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in\_\-file}]File handle. \item[{\em num\_\-bytes}]Number of bytes to read and discard.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


Referenced by main(), and process\_\-record().\hypertarget{siis2moc_8c_4dfbc39bb1af308cb4e8a47df3eeea34}{
\index{siis2moc.c@{siis2moc.c}!start\_\-message\_\-system@{start\_\-message\_\-system}}
\index{start\_\-message\_\-system@{start\_\-message\_\-system}!siis2moc.c@{siis2moc.c}}
\subsubsection[{start\_\-message\_\-system}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int start\_\-message\_\-system (void)\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_4dfbc39bb1af308cb4e8a47df3eeea34}


Start the messaging system.

\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


References print\_\-message().

Referenced by main().\hypertarget{siis2moc_8c_8a496935458c894673aef04c95c4a737}{
\index{siis2moc.c@{siis2moc.c}!stop\_\-message\_\-system@{stop\_\-message\_\-system}}
\index{stop\_\-message\_\-system@{stop\_\-message\_\-system}!siis2moc.c@{siis2moc.c}}
\subsubsection[{stop\_\-message\_\-system}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int stop\_\-message\_\-system (void)\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_8a496935458c894673aef04c95c4a737}


Stop the messaging system.

\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


Referenced by main().\hypertarget{siis2moc_8c_eb9375542481b6fcaa9c0d0184605b1d}{
\index{siis2moc.c@{siis2moc.c}!write\_\-ccsds\_\-packet@{write\_\-ccsds\_\-packet}}
\index{write\_\-ccsds\_\-packet@{write\_\-ccsds\_\-packet}!siis2moc.c@{siis2moc.c}}
\subsubsection[{write\_\-ccsds\_\-packet}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int write\_\-ccsds\_\-packet ({\bf SIIS\_\-Pdu\_\-Hdr} $\ast$ {\em pdu\_\-hdr}, \/  const unsigned char $\ast$ {\em data}, \/  const unsigned int {\em data\_\-bytes}, \/  const unsigned short {\em apid}, \/  const unsigned short {\em length})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{siis2moc_8c_eb9375542481b6fcaa9c0d0184605b1d}


Write a CCSDS packet and packet annotation header to a level 0 MOC file. There is a separate file for each APID/VCID. The file is created if this is the first packet for a given file.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em pdu\_\-hdr}]Pointer to packet annotation header information. \item[{\em data}]Pointer to start of the packet buffer. \item[{\em data\_\-bytes}]Number of bytes of data in the packet buffer. \item[{\em apid}]APID for the packet. \item[{\em length}]Length of the packet, in bytes, as reported in its header.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A SIIS MSG value. \end{Desc}


References Apid\_\-Count, \_\-Apid\_\-Info::exclude, \_\-SIIS\_\-Pdu\_\-Hdr::fill\_\-offset, get\_\-apid\_\-info(), \_\-Apid\_\-Info::moc\_\-file, Packet\_\-Write\_\-Count, \_\-SIIS\_\-Pdu\_\-Hdr::pkt\_\-incomplete, \_\-Apid\_\-Info::read\_\-count, SIIS\_\-mocHdrSizeof(), SIIS\_\-mocPutHdr(), and \_\-Apid\_\-Info::write\_\-count.

Referenced by extract\_\-ccsds\_\-packets().