<?xml version="1.0" encoding="ISO-8859-1"?>
<refentry id="stdin" xmlns="http://docbook.org/ns/docbook" version="5.0">
  <!--
                    Header
  -->
  <refmeta>
    <refentrytitle>RD_ListLogs</refentrytitle>
    <manvolnum>7</manvolnum>
    <refmiscinfo class='source'>October 2015</refmiscinfo>
    <refmiscinfo class='manual'>Rivendell C Library Manual</refmiscinfo>
  </refmeta>
  <refnamediv>
    <refname>rd_listlogs</refname>
    <refpurpose>Rivendell List Logs C Library Function</refpurpose>
  </refnamediv>
  <info>
    <author>
      <personname>
        <firstname>Todd</firstname>
        <surname>Baker</surname>
        <email>bakert@rfa.org</email>
      </personname>
      <contrib>Rivendell C Library Author</contrib>
    </author>
  </info>

  <!--
                    Body
  -->
  <refsynopsisdiv id='synopsis'>
    <funcsynopsis>
    <funcsynopsisinfo>#include &lt;rivwebcapi/rd_listlogs.h&gt;</funcsynopsisinfo>
    <funcprototype>
    <funcdef>int <function>RD_ListLogs</function></funcdef>
      <paramdef> struct rd_logline * <parameter>logline[]</parameter></paramdef>
      <paramdef>const char <parameter>hostname[]</parameter></paramdef>
      <paramdef>const char <parameter>username[]</parameter></paramdef>
      <paramdef>const char <parameter>passwd[]</parameter></paramdef>
      <paramdef>const char <parameter>ticket[]</parameter></paramdef>
      <paramdef>const char <parameter>logname[]</parameter></paramdef>
      <paramdef>const char <parameter>servicename[]</parameter></paramdef>
      <paramdef>const int  <parameter>trackable</parameter></paramdef>
      <paramdef>const char <parameter>filter[]</parameter></paramdef>
      <paramdef>const int  <parameter>recent</parameter></paramdef>
      <paramdef>const char <parameter>user_agent[]</parameter></paramdef>
      <paramdef>unsigned * <parameter>numrecs</parameter></paramdef>
    </funcprototype> 
    </funcsynopsis>

  </refsynopsisdiv>

  <refsect1 id='description'><title>Description</title>
  <para>
    <command>RD_ListLogs</command> is  the function to use
    to list the log files that are stored within the Rivendell Database.
  </para>
  <para>
    This function lists the names of the Log Files in the system.
  </para>
  <table xml:id="ex.listlogs" frame="all">
    <title>RD_ListLogs function call fields</title>
    <tgroup cols="4" align="left" colsep="1" rowsep="1">
      <colspec colname="FIELD NAME" />
      <colspec colname="FIELD TYPE" />
      <colspec colname="MEANING" />
      <colspec colname="REMARKS" />
      <thead>
        <row>
          <entry>
            FIELD NAME
          </entry>
          <entry>
            FIELD TYPE
          </entry>
          <entry>
            MEANING
          </entry>
          <entry>
            REMARKS
          </entry>
        </row>
      </thead>
      <tbody>
        <row>
          <entry>
            *logline[]
          </entry>
          <entry>
          Pointer to rd_logline structure
          </entry>
          <entry>
            Memory location to store logline information
          </entry>
          <entry>
            Mandatory
          </entry>
        </row>
        <row>
          <entry>
            hostname
          </entry>
          <entry>
          Character Array
          </entry>
          <entry>
            Name Of Rivendell DB Host
          </entry>
          <entry>
            Mandatory
          </entry>
        </row>
        <row>
          <entry>
            username
          </entry>
          <entry>
          Character Array
          </entry>
          <entry>
            Rivendell User Name
          </entry>
          <entry>
            Mandatory When NO Ticket Provided
          </entry>
        </row>
        <row>
          <entry>
            passwd
          </entry>
          <entry>
          Character Array
          </entry>
          <entry>
            Rivendell User Password
          </entry>
          <entry>
            Mandatory When NO Ticket Provided
          </entry>
        </row>
        <row>
          <entry>
            ticket
          </entry>
          <entry>
          Character Array
          </entry>
          <entry>
            Rivendell Authentification Ticket
          </entry>
          <entry>
            Mandatory When NO User/Password Pair Provided.
          </entry>
        </row>
        <row>
          <entry>
            servicename
          </entry>
          <entry>
          character array
          </entry>
          <entry>
            Service Name
          </entry>
          <entry>
            Optional
          </entry>
        </row>
        <row>
          <entry>
            logname
          </entry>
          <entry>
          character array
          </entry>
          <entry>
            Log Name
          </entry>
          <entry>
            Optional
          </entry>
        </row>
        <row>
          <entry>
            trackable
          </entry>
          <entry>
          integer
          </entry>
          <entry>
            Limit returns to logs that contain voicetrack(s). 0=No, 1=Yes (Default).
          </entry>
          <entry>
            Optional
          </entry>
        </row>
        <row>
          <entry>
            filter
          </entry>
          <entry>
          Character Array
          </entry>
          <entry>
	    Limit returns to logs that contain the specified string
	    in their Name, Description or Service fields.
          </entry>
          <entry>
            Optional
          </entry>
        </row>
        <row>
          <entry>
	    recent
          </entry>
          <entry>
          integer
          </entry>
          <entry>
	    Return only the 14 most recently modified logs.
          </entry>
          <entry>
            Optional
          </entry>
        </row>
        <row>
          <entry>
            user_agent
          </entry>
          <entry>
          Character Array
          </entry>
          <entry>
            User Agent Value put into HTTP request
          </entry>
          <entry>
            Optional (default is Rivendell-C-API/x.x.x)
          </entry>
        </row>
        <row>
          <entry>
            *numrecs
          </entry>
          <entry>
          pointer to integer
          </entry>
          <entry>
            memory location for number of records returned
          </entry>
          <entry>
            Mandatory
          </entry>
        </row>
      </tbody>
    </tgroup>
  </table>

  <para>
    When successful function will return the number of records sent (numrecs) and rd_log structure which 
    is stored in the provided memory locations. The rd_log structure has the following fields:
  </para>
  <programlisting>
	struct rd_log {
  		char  log_name[41];
  		char  log_service[41];
  		char  log_description[257];
  		char  log_origin_username[1021];
  		struct tm  log_origin_datetime;
		struct tm  log_purge_date;
  		struct tm  log_link_datetime;
  		struct tm  log_modified_datetime;
  		int   log_autorefresh;
  		char  log_startdate[30];
  		char  log_enddate[30];
  		int   log_scheduled_tracks;
  		int   log_completed_tracks;
  		int   log_music_links;
  		int   log_music_linked;
  		int   log_traffic_links;
  		int   log_traffic_linked;
	};

      All character arrays above are the sizes listed and must be null-terminated.
      Character encoding is UTF-8.

  </programlisting>

  </refsect1>
  <refsect2 id='returns'><title>RETURN VALUE</title>
    <para>
      On success, zero is returned. Using the provided parameters an rd_log
structure is returned and the number of records is returned.
    </para>
    <para>
      If a server error occurs a -1 is returned.
      If a client error occurs a specific error number is returned.
    </para>
  </refsect2>
  <refsect3 id='errors'><title>ERRORS</title>
    <para>
      403          User Authentification Error.
    </para>
    <para>
      nnn  Unknown Error Occurred.
    </para>
  </refsect3>
     
</refentry>
