[svn r416] added static to socket_send function from gmyth_vlc.c trunk
authorleo_sobral
Sat Mar 10 15:01:25 2007 +0000 (2007-03-10)
branchtrunk
changeset 4112127788267bd
parent 410 7b062aa36323
child 412 60a60397ffdf
[svn r416] added static to socket_send function from gmyth_vlc.c
gmyth/src/gmyth_vlc.c
     1.1 --- a/gmyth/src/gmyth_vlc.c	Fri Mar 09 17:57:59 2007 +0000
     1.2 +++ b/gmyth/src/gmyth_vlc.c	Sat Mar 10 15:01:25 2007 +0000
     1.3 @@ -35,7 +35,9 @@
     1.4  #include "gmyth_debug.h"
     1.5  #include "gmyth_socket.h"
     1.6  
     1.7 -
     1.8 +/* static functions */
     1.9 +static int _socket_send(int socket, gchar* msg);
    1.10 +static int _socket_recv(int socket, gchar* buf);
    1.11  
    1.12  /** Primitive function to send a message through the socket
    1.13   *
    1.14 @@ -43,7 +45,8 @@
    1.15   * @param msg the message itself
    1.16   * @return 0 if success
    1.17   */
    1.18 -int socket_send(int socket, gchar* msg)
    1.19 +static int 
    1.20 +_socket_send(int socket, gchar* msg)
    1.21  {  
    1.22    size_t size = strlen(msg) + 2; // (\n + \0)
    1.23      gchar* final = (gchar *)g_malloc0(sizeof(gchar) * size);
    1.24 @@ -63,7 +66,8 @@
    1.25   * @param buf Buffer to put the message
    1.26   * @return 0 if success
    1.27   */
    1.28 -int socket_recv(int socket, gchar* buf)
    1.29 +static int 
    1.30 +_socket_recv(int socket, gchar* buf)
    1.31  {
    1.32    int numbytes = 0;
    1.33  
    1.34 @@ -86,7 +90,8 @@
    1.35   * @param the params for the option
    1.36   * @return 0 if success
    1.37   */
    1.38 -int gmyth_vlc_setup_output(GMythVlc *vlc, int output, \
    1.39 +int 
    1.40 +gmyth_vlc_setup_output(GMythVlc *vlc, int output, \
    1.41                             gchar* kind, gchar* opts)
    1.42  {
    1.43      int ret;
    1.44 @@ -96,14 +101,13 @@
    1.45      g_snprintf(msg, size, "setup output%d %s %s", output,\
    1.46                 kind, opts);
    1.47  
    1.48 -    ret = socket_send(vlc->sockfd, msg);
    1.49 +    ret = _socket_send(vlc->sockfd, msg);
    1.50  
    1.51      g_free(msg);
    1.52      return ret;
    1.53  }
    1.54  
    1.55  
    1.56 -
    1.57  /** Function to clean the playlist
    1.58   *
    1.59   * @param vlc structure with options for vlc
    1.60 @@ -111,9 +115,10 @@
    1.61   * @param file the file we want to insert in the playlist
    1.62   * @return 0 if success
    1.63   */
    1.64 -int gmyth_vlc_clean_playlist(GMythVlc *vlc)
    1.65 +int 
    1.66 +gmyth_vlc_clean_playlist(GMythVlc *vlc)
    1.67  {
    1.68 -  return socket_send(vlc->sockfd, "del all");
    1.69 +  return _socket_send(vlc->sockfd, "del all");
    1.70  }
    1.71  
    1.72  
    1.73 @@ -124,7 +129,8 @@
    1.74   * @param command play, stop or pause(just for vod)
    1.75   * @return 0 if success
    1.76   */
    1.77 -int gmyth_vlc_control_input(GMythVlc *vlc, int output, \
    1.78 +int 
    1.79 +gmyth_vlc_control_input(GMythVlc *vlc, int output, \
    1.80                             gchar* command)
    1.81  {
    1.82      size_t size = 25;
    1.83 @@ -132,7 +138,7 @@
    1.84      g_snprintf(msg, size, "control output%d %s", output,\
    1.85                 command);
    1.86  
    1.87 -    int ret = socket_send(vlc->sockfd, msg);
    1.88 +    int ret = _socket_send(vlc->sockfd, msg);
    1.89      
    1.90      g_free(msg);
    1.91      return ret;
    1.92 @@ -147,7 +153,8 @@
    1.93   * @param file the file we want to insert in the playlist
    1.94   * @return 0 if success
    1.95   */
    1.96 -int gmyth_vlc_create_input(GMythVlc *vlc, int output,\
    1.97 +int 
    1.98 +gmyth_vlc_create_input(GMythVlc *vlc, int output,\
    1.99                             gchar* file)
   1.100  {
   1.101      return gmyth_vlc_setup_output(vlc, output, "input",\
   1.102 @@ -162,7 +169,8 @@
   1.103   * @param port
   1.104   * @return 0 if success
   1.105   */
   1.106 -int gmyth_vlc_create_channel(GMythVlc *vlc, gchar* type,\
   1.107 +int 
   1.108 +gmyth_vlc_create_channel(GMythVlc *vlc, gchar* type,\
   1.109                               int port, int vcodec)
   1.110  {
   1.111      int ret;
   1.112 @@ -171,7 +179,7 @@
   1.113      g_snprintf(msg, size, "new output%d %s enabled loop", \
   1.114               vlc->n_outputs, type);
   1.115  
   1.116 -    ret = socket_send(vlc->sockfd, msg);
   1.117 +    ret = _socket_send(vlc->sockfd, msg);
   1.118  
   1.119      if (ret > -1)
   1.120      {
   1.121 @@ -218,7 +226,8 @@
   1.122   * @param passwd the password for telnet interface
   1.123   * @return 0 if success
   1.124   */
   1.125 -int gmyth_vlc_connect(GMythVlc *vlc, GMythBackendInfo *backend_info,\
   1.126 +int 
   1.127 +gmyth_vlc_connect(GMythVlc *vlc, GMythBackendInfo *backend_info,\
   1.128                        gchar* passwd, int port)
   1.129  {
   1.130      int numbytes;  
   1.131 @@ -250,15 +259,15 @@
   1.132  
   1.133  
   1.134      // Receive the Password's Prompt
   1.135 -    numbytes = socket_recv(vlc->sockfd, vlc->buf);
   1.136 +    numbytes = _socket_recv(vlc->sockfd, vlc->buf);
   1.137  
   1.138      // Send the Password. We don't have to
   1.139      // care about passwords being sent in plain text
   1.140      // because telnet protocol does it.
   1.141 -    socket_send(vlc->sockfd, passwd);
   1.142 +    _socket_send(vlc->sockfd, passwd);
   1.143  
   1.144      // Receive the Welcome msg
   1.145 -    numbytes = socket_recv(vlc->sockfd, vlc->buf);
   1.146 +    numbytes = _socket_recv(vlc->sockfd, vlc->buf);
   1.147      if (numbytes > -1)
   1.148        if (strncmp(vlc->buf,"\r\nWrong password.", 17) == 0)
   1.149        {
   1.150 @@ -277,7 +286,8 @@
   1.151   * @param backend_info infos about the backend
   1.152   * @return 0 if success
   1.153   */
   1.154 -int gmyth_vlc_disconnect(GMythVlc *vlc)
   1.155 +int 
   1.156 +gmyth_vlc_disconnect(GMythVlc *vlc)
   1.157  {
   1.158  
   1.159      int ret;