]> code.delx.au - pulseaudio/blobdiff - polyp/pdispatch.c
Make the whole stuff LGPL only
[pulseaudio] / polyp / pdispatch.c
index 9ed91fc594a4152b2fe2028196338daf808cc402..90de345f79492ed6d66e02ed7dff756dadd034a4 100644 (file)
@@ -4,17 +4,17 @@
   This file is part of polypaudio.
  
   polypaudio is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published
-  by the Free Software Foundation; either version 2 of the License,
-  or (at your option) any later version.
+  it under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation; either version 2.1 of the
+  License, or (at your option) any later version.
  
   polypaudio is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  General Public License for more details.
+  Lesser General Public License for more details.
  
-  You should have received a copy of the GNU General Public License
-  along with polypaudio; if not, write to the Free Software
+  You should have received a copy of the GNU Lesser General Public
+  License along with polypaudio; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
   USA.
 ***/
@@ -31,8 +31,9 @@
 #include "native-common.h"
 #include "xmalloc.h"
 #include "llist.h"
+#include "log.h"
 
-/*#define DEBUG_OPCODES*/
+/* #define DEBUG_OPCODES */
 
 #ifdef DEBUG_OPCODES
 
@@ -47,7 +48,7 @@ static const char *command_names[PA_COMMAND_MAX] = {
     [PA_COMMAND_AUTH] = "AUTH",
     [PA_COMMAND_REQUEST] = "REQUEST",
     [PA_COMMAND_EXIT] = "EXIT",
-    [PA_COMMAND_SET_NAME] = "SET_NAME",
+    [PA_COMMAND_SET_CLIENT_NAME] = "SET_CLIENT_NAME",
     [PA_COMMAND_LOOKUP_SINK] = "LOOKUP_SINK",
     [PA_COMMAND_LOOKUP_SOURCE] = "LOOKUP_SOURCE",
     [PA_COMMAND_DRAIN_PLAYBACK_STREAM] = "DRAIN_PLAYBACK_STREAM",
@@ -60,6 +61,30 @@ static const char *command_names[PA_COMMAND_MAX] = {
     [PA_COMMAND_FINISH_UPLOAD_STREAM] = "FINISH_UPLOAD_STREAM",
     [PA_COMMAND_PLAY_SAMPLE] = "PLAY_SAMPLE",
     [PA_COMMAND_REMOVE_SAMPLE] = "REMOVE_SAMPLE",
+    [PA_COMMAND_GET_SERVER_INFO] = "GET_SERVER_INFO",
+    [PA_COMMAND_GET_SINK_INFO] = "GET_SINK_INFO",
+    [PA_COMMAND_GET_SINK_INFO_LIST] = "GET_SINK_INFO_LIST",
+    [PA_COMMAND_GET_SOURCE_INFO] = "GET_SOURCE_INFO",
+    [PA_COMMAND_GET_SOURCE_INFO_LIST] = "GET_SOURCE_INFO_LIST",
+    [PA_COMMAND_GET_MODULE_INFO] = "GET_MODULE_INFO",
+    [PA_COMMAND_GET_MODULE_INFO_LIST] = "GET_MODULE_INFO_LIST",
+    [PA_COMMAND_GET_CLIENT_INFO] = "GET_CLIENT_INFO",
+    [PA_COMMAND_GET_CLIENT_INFO_LIST] = "GET_CLIENT_INFO_LIST",
+    [PA_COMMAND_GET_SAMPLE_INFO] = "GET_SAMPLE_INFO",
+    [PA_COMMAND_GET_SAMPLE_INFO_LIST] = "GET_SAMPLE_INFO_LIST",
+    [PA_COMMAND_GET_SINK_INPUT_INFO] = "GET_SINK_INPUT_INFO",
+    [PA_COMMAND_GET_SINK_INPUT_INFO_LIST] = "GET_SINK_INPUT_INFO_LIST",
+    [PA_COMMAND_GET_SOURCE_OUTPUT_INFO] = "GET_SOURCE_OUTPUT_INFO",
+    [PA_COMMAND_GET_SOURCE_OUTPUT_INFO_LIST] = "GET_SOURCE_OUTPUT_INFO_LIST",
+    [PA_COMMAND_SUBSCRIBE] = "SUBSCRIBE",
+    [PA_COMMAND_SUBSCRIBE_EVENT] = "SUBSCRIBE_EVENT",
+    [PA_COMMAND_SET_SINK_VOLUME] = "SET_SINK_VOLUME",
+    [PA_COMMAND_SET_SINK_INPUT_VOLUME] = "SET_SINK_INPUT_VOLUME",
+    [PA_COMMAND_TRIGGER_PLAYBACK_STREAM] = "TRIGGER_PLAYBACK_STREAM",
+    [PA_COMMAND_FLUSH_PLAYBACK_STREAM] = "FLUSH_PLAYBACK_STREAM",
+    [PA_COMMAND_CORK_PLAYBACK_STREAM] = "CORK_PLAYBACK_STREAM",
+    [PA_COMMAND_GET_AUTOLOAD_INFO] = "GET_AUTOLOAD_INFO",
+    [PA_COMMAND_GET_AUTOLOAD_INFO_LIST] = "GET_AUTOLOAD_INFO_LIST",
 };
 
 #endif
@@ -162,7 +187,14 @@ int pa_pdispatch_run(struct pa_pdispatch *pd, struct pa_packet*packet, void *use
         goto finish;
 
 #ifdef DEBUG_OPCODES
-    fprintf(stderr, __FILE__": Recieved opcode <%s>\n", command_names[command]);
+{
+    char t[256];
+    char const *p;
+    if (!(p = command_names[command]))
+        snprintf((char*) (p = t), sizeof(t), "%u", command);
+        
+    pa_log(__FILE__": Recieved opcode <%s>\n", p);
+}
 #endif
 
     if (command == PA_COMMAND_ERROR || command == PA_COMMAND_REPLY) {
@@ -175,13 +207,14 @@ int pa_pdispatch_run(struct pa_pdispatch *pd, struct pa_packet*packet, void *use
         if (r)
             run_action(pd, r, command, ts);
 
-    } else if (pd->command_table && command < pd->n_commands) {
+    } else if (pd->command_table && (command < pd->n_commands) && pd->command_table[command].proc) {
         const struct pa_pdispatch_command *c = pd->command_table+command;
 
-        if (c->proc)
-            c->proc(pd, command, tag, ts, userdata);
-    } else
+        c->proc(pd, command, tag, ts, userdata);
+    } else {
+        pa_log(__FILE__": Recieved unsupported command %u\n", command);
         goto finish;
+    }
 
     ret = 0;