gmyth/src/gmyth_http.h
author rosfran
Wed May 23 19:50:41 2007 +0100 (2007-05-23)
branchtrunk
changeset 701 2f28edb4d804
parent 698 9019388af980
child 750 312d6bc514f3
permissions -rw-r--r--
[svn r707] Fixed the wrong commentary indentation.
     1 /**
     2  * GMyth Library
     3  *
     4  * @file gmyth/gmyth_http.h
     5  * 
     6  * @brief <p> GMythHttp library provides a wrapper to access
     7  * data from the database using http+xml
     8  *
     9  * Copyright (C) 2007 INdT - Instituto Nokia de Tecnologia.
    10  * @author Artur Duque de Souza <artur.souza@indt.org.br>
    11  *
    12  *
    13  * This program is free software; you can redistribute it and/or modify
    14  * it under the terms of the GNU Lesser General Public License as published by
    15  * the Free Software Foundation; either version 2 of the License, or
    16  * (at your option) any later version.
    17  *
    18  * This program is distributed in the hope that it will be useful,
    19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    21  * GNU General Public License for more details.
    22  *
    23  * You should have received a copy of the GNU Lesser General Public License
    24  * along with this program; if not, write to the Free Software
    25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    26  */
    27 
    28 #ifndef __GMYTH_HTTP_H__
    29 #define __GMYTH_HTTP_H__
    30 
    31 #include <glib-object.h>
    32 
    33 #include <stdio.h>
    34 #include <stdlib.h>
    35 #include <string.h>
    36 #include <stdarg.h>
    37 #include <glib.h>
    38 #include <glib/gprintf.h>
    39 
    40 #include "gmyth_backendinfo.h"
    41 #include "gmyth_util.h"
    42 #include "gmyth_recprofile.h"
    43 
    44 #include <curl/curl.h>
    45 #include <curl/types.h>
    46 #include <curl/easy.h>
    47 
    48 G_BEGIN_DECLS
    49 #define MYTH_PORT_STATUS 6544
    50 #define JOB_UNKNOWN   0x0000
    51 #define JOB_QUEUED    0x0001
    52 #define JOB_PENDING   0x0002
    53 #define JOB_STARTING  0x0003
    54 #define JOB_RUNNING   0x0004
    55 #define JOB_STOPPING  0x0005
    56 #define JOB_PAUSED    0x0006
    57 #define JOB_RETRY     0x0007
    58 #define JOB_ERRORING  0x0008
    59 #define JOB_ABORTING  0x0009
    60 // JOB_DONE is a mask to indicate the job is done
    61 // whatever the status is
    62 #define JOB_DONE      0x0100
    63 #define JOB_FINISHED  0x0110
    64 #define JOB_ABORTED   0x0120
    65 #define JOB_ERRORED   0x0130
    66 #define JOB_CANCELLED 0x0140
    67 typedef struct _GMythRecorded_Recording GMythRecorded_Recording;
    68 typedef struct _GMythRecorded_Channel GMythRecorded_Channel;
    69 typedef struct _GMythRecorded_Program GMythRecorded_Program;
    70 typedef struct _GMythRecorded GMythRecorded;
    71 typedef struct _GMythProgram GMythProgram;
    72 typedef struct _GMythChannel GMythChannel;
    73 typedef struct _GMythEpg GMythEpg;
    74 typedef struct _MemoryStruct MemoryStruct;
    75 
    76 struct _MemoryStruct
    77     {
    78         char *memory;
    79         size_t size;
    80     };
    81 
    82 struct _GMythProgram
    83     {
    84         gchar *title;
    85         gchar *subtitle;
    86         gchar *catType;
    87         gchar *category;
    88         gint repeat;
    89         GTimeVal *startTime;
    90         GTimeVal *endTime;
    91     };
    92 
    93 struct _GMythChannel
    94     {
    95         gchar *channelName;
    96         gchar *chanNum;
    97         gint chanId;
    98         gint callSign;
    99         GSList *programList;
   100     };
   101 
   102 struct _GMythEpg
   103     {
   104         gint startChanId;
   105         gint endChanId;
   106         gchar *version;
   107         gint protoVer;
   108         gint totalCount;
   109         gint numOfChannels;
   110         GTimeVal *asOf;
   111         GTimeVal *startTime;
   112         GTimeVal *endTime;
   113         gint details;
   114         GSList *channelList;
   115     };
   116 
   117 
   118 struct _GMythRecorded_Recording
   119     {
   120         gint dupInType;
   121         gint dupMethod;
   122         gchar *playGroup;
   123         gchar *recGroup;
   124         gchar *recProfile;
   125         gint recPriority;
   126         gint recStatus;
   127         gint encoderId;
   128         gint recordId;
   129         gint recType;
   130         GTimeVal *recStartTs;
   131         GTimeVal *recEndTs;
   132     };
   133 
   134 
   135 struct _GMythRecorded_Channel
   136     {
   137         gchar *chanFilters;
   138         gchar *channelName;
   139         gint chanNum;
   140         gint sourceId;
   141         gint commFree;
   142         gint inputId;
   143         gint chanId;
   144         gint callSign;
   145     };
   146 
   147 
   148 struct _GMythRecorded_Program
   149     {
   150         gint programFlags;
   151         gchar *title;
   152         gint programId;
   153         gchar *catType;
   154         gchar *category;
   155         gint seriesId;
   156         GTimeVal *startTime;
   157         GTimeVal *endTime;
   158         GTimeVal *airdate;      //?
   159         GTimeVal *lastModified;
   160         gchar *subTitle;
   161         gint stars;
   162         gint repeat;
   163         gint fileSize;
   164         gchar *hostname;
   165         GMythRecorded_Channel channel;
   166         GMythRecorded_Recording recording;
   167     };
   168 
   169 struct _GMythRecorded
   170     {
   171         gchar *version;
   172         gint protoVer;
   173         gint totalCount;
   174         GTimeVal *asOf;
   175         GSList *programList;
   176     };
   177 
   178 
   179 gint gmyth_http_retrieve_job_status ( GMythBackendInfo * backend_info,
   180                                       gint chanid, GTimeVal * start );
   181 
   182 gchar *gmyth_http_retrieve_setting ( GMythBackendInfo * backend_info,
   183                                      gchar * key, gchar * hostname );
   184 
   185 GMythEpg gmyth_http_retrieve_epg ( GMythBackendInfo * backend_info,
   186                                    GTimeVal * StartTime, GTimeVal * EndTime,
   187                                    gint StartChanId, gint NumOfChannels,
   188                                    gchar * Details );
   189 
   190 GMythRecorded gmyth_http_retrieve_recorded ( GMythBackendInfo * backend_info );
   191 
   192 GSList *gmyth_http_retrieve_rec_profiles ( GMythBackendInfo * backend_info,
   193                                            gchar * groupname );
   194 
   195 gint gmyth_http_create_rec_profile ( GMythBackendInfo * backend_info,
   196                                      GMythRecProfile * profile );
   197 
   198 gint gmyth_http_del_rec_profile ( GMythBackendInfo * backend_info, gint id );
   199 
   200 MemoryStruct gmyth_http_request ( GMythBackendInfo * backend_info,
   201                                   GString * command );
   202 
   203 G_END_DECLS
   204 #endif /* __GMYTH_HTTP_H__ */