The experimental code in echld/ also got broken by the wtap
authorjmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 8 Nov 2013 11:50:57 +0000 (11:50 +0000)
committerjmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 8 Nov 2013 11:50:57 +0000 (11:50 +0000)
file types commit. Make this compile again as well.
Trivial whitespace cleanup while in those files.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@53168 f5534014-38df-0310-8fa8-9805f1628bb7

echld/child.c
echld/dispatcher.c

index 15817fe5041e84a98c01de502f1a09975e2f424e..e40de30a411aa3073b2f53f2b938da7f2c48dfcb 100644 (file)
@@ -76,7 +76,7 @@ static int debug_lvl = DEBUG_CHILD;
 static FILE* debug_fp = NULL;
 #define DBG_BUF_LEN 1024
 
-#define DCOM() 
+#define DCOM()
 
 int child_debug(int level, const char* fmt, ...) {
        va_list ap;
@@ -130,18 +130,18 @@ static long dbg_resp(GByteArray* em, echld_msg_type_t t) {
 #define CHILD_STATE(ST) do { DISP_DBG((0,"State %s => %s")) } while(0)
 #else
 #define CHILD_DBG(attrs)
-#define CHILD_DBG_INIT() 
-#define CHILD_DBG_START(fname) 
+#define CHILD_DBG_INIT()
+#define CHILD_DBG_START(fname)
 #define CHILD_RESP(BA,T) echld_write_frame(child.fds.pipe_to_parent,(BA),child.chld_id,T,child.reqh_id,NULL)
 #endif
 
 
-static struct timeval close_sleep_time; 
+static struct timeval close_sleep_time;
 
 
 static void sig_term(int sig _U_) {
        CHILD_DBG((3,"Terminated, Closing"));
-       exit(0);        
+       exit(0);
 }
 
 extern void echld_child_initialize(echld_chld_id_t chld_id, int pipe_from_parent, int pipe_to_parent, int reqh_id, echld_epan_stuff_t* es) {
@@ -234,7 +234,7 @@ static char* param_get_packet_count(char** err) {
 
 static echld_bool_t param_set_dfilter(char* val , char** err _U_) {
        dfilter_t *dfn = NULL;
-       
+
        if (child.state != IDLE && child.state != DONE ) {
                *err = g_strdup("Only while idle or done");
                return FALSE;
@@ -258,7 +258,7 @@ static echld_bool_t param_set_profile(char* val , char** err ) {
 
        if (child.state != IDLE) {
                *err = g_strdup_printf("Cannot set Profile \"%s\", too late.", val);
-               return FALSE;           
+               return FALSE;
        }
 
        if (profile_exists (val, FALSE)) {
@@ -288,21 +288,21 @@ static char* param_get_file_list(char** err) {
 
        while(( file = g_dir_read_name(dir) )) {
                g_string_append_printf(str,"{filename='%s'},\n",file);
-       } 
-       g_dir_close(dir);
+       }
+       g_dir_close(dir);
 
        g_string_truncate(str, str->len-2); /* ',\n' */
        g_string_append(str, "]}");
 
-       s=str->str;
-       g_string_free(str,FALSE);
-       return s;
+       s=str->str;
+       g_string_free(str,FALSE);
+       return s;
 }
 
 #ifdef PCAP_NG_DEFAULT
-static int out_file_type = WTAP_FILE_PCAPNG;
+static int out_file_type = WTAP_FILE_TYPE_SUBTYPE_PCAPNG;
 #else
-static int out_file_type = WTAP_FILE_PCAP;
+static int out_file_type = WTAP_FILE_TYPE_SUBTYPE_PCAP;
 #endif
 
 static echld_bool_t param_set_out_file_type(char* val, char** err) {
@@ -311,7 +311,7 @@ static echld_bool_t param_set_out_file_type(char* val, char** err) {
       if (oft < 0) {
         *err = g_strdup_printf("\"%s\" isn't a valid capture file type", val);
         return FALSE;
-      } else { 
+      } else {
                out_file_type = oft;
                return TRUE;
          }
@@ -384,7 +384,7 @@ static void child_start_capture(void) {
 static void child_stop_capure(void) {
        CHILD_DBG((2,"CMD stop capture"));
        child_err(ECHLD_ERR_UNIMPLEMENTED,child.reqh_id,"stop capture not implemented yet!");
-       child.state = DONE;     
+       child.state = DONE;
 }
 
 static void child_get_summary(char* range) {
@@ -428,7 +428,7 @@ static long child_receive(guint8* b, size_t len, echld_chld_id_t chld_id, echld_
 
        // gettimeofday(&(child.now), NULL);
 
-       if (child.chld_id != chld_id) { 
+       if (child.chld_id != chld_id) {
                child_err(ECHLD_ERR_WRONG_MSG,reqh_id,
                        "chld_id: own:%d given:%d msg_type='%s'",child.chld_id,chld_id,TY(type));
                return 0;
@@ -484,7 +484,7 @@ static long child_receive(guint8* b, size_t len, echld_chld_id_t chld_id, echld_
                                        g_free(err);
                                        return 0;
                                }
-                                                               
+
                                gba = child.enc->param(param,val);
                                CHILD_RESP(gba,ECHLD_PARAM);
                                g_byte_array_free(gba,TRUE);
@@ -517,7 +517,7 @@ static long child_receive(guint8* b, size_t len, echld_chld_id_t chld_id, echld_
                        char* pars;
 
                        if (child.state != IDLE) goto wrong_state;
-                       
+
                        if ( child.dec->open_interface(b,len,&intf,&pars) ) {
                                child_open_interface(intf,pars);
                        } else {
@@ -529,7 +529,7 @@ static long child_receive(guint8* b, size_t len, echld_chld_id_t chld_id, echld_
                        if (child.state != READY) goto wrong_state;
                        child_start_capture();
                        break;
-               }                                       
+               }
                case ECHLD_STOP_CAPTURE: {
                        if (child.state != CAPTURING) goto wrong_state;
                        child_stop_capure();
@@ -549,7 +549,7 @@ static long child_receive(guint8* b, size_t len, echld_chld_id_t chld_id, echld_
                }
                case ECHLD_GET_TREE:{
                        char* range;
-                       
+
                        if (child.state != CAPTURING && child.state != READING && child.state != DONE) goto wrong_state;
 
                        if ( child.dec->get_tree(b,len,&range) ) {
@@ -561,7 +561,7 @@ static long child_receive(guint8* b, size_t len, echld_chld_id_t chld_id, echld_
                }
                case ECHLD_GET_BUFFER:{
                        char* name;
-                       
+
                        if (child.state != CAPTURING && child.state != READING && child.state != DONE) goto wrong_state;
 
                        if ( child.dec->get_buffer(b,len,&name) ) {
@@ -574,7 +574,7 @@ static long child_receive(guint8* b, size_t len, echld_chld_id_t chld_id, echld_
                case ECHLD_ADD_NOTE: {
                        int framenum;
                        char* note;
-                       
+
                        if (child.state != CAPTURING && child.state != READING && child.state != DONE) goto wrong_state;
 
                        if ( child.dec->add_note(b,len,&framenum,&note) ) {
@@ -586,7 +586,7 @@ static long child_receive(guint8* b, size_t len, echld_chld_id_t chld_id, echld_
                }
                case ECHLD_APPLY_FILTER: {
                        char* filter;
-                       
+
                        if (child.state != DONE) goto wrong_state;
 
                        if ( child.dec->apply_filter(b,len,&filter) ) {
@@ -599,7 +599,7 @@ static long child_receive(guint8* b, size_t len, echld_chld_id_t chld_id, echld_
                case ECHLD_SAVE_FILE: {
                        char* filename;
                        char* pars;
-                       
+
                        if (child.state != DONE) goto wrong_state;
 
                        if ( child.dec->save_file(b,len,&filename,&pars) ) {
index e7ab35bdc6901e54b411557109c0a909b8c40f86..3dbe8f0048939759139f6733bd53aae0c34a8108 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 #include "echld-int.h"
-/** 
+/**
   DISPATCHER
   **/
 
@@ -77,7 +77,7 @@ int dispatcher_debug(int level, const char* fmt, ...) {
 
        if (debug_lvl<level) return 1;
 
-    va_start(ap, fmt);
+       va_start(ap, fmt);
        str = g_strdup_vprintf(fmt,ap);
        va_end(ap);
 
@@ -140,7 +140,7 @@ static echld_epan_stuff_t stuff;
 static void init_stuff(void) {
 #ifdef HAVE_LIBPCAP
        capture_opts_init(&stuff.cap_opts);
-       capture_session_init(&stuff.cap_sess, (void *)&stuff.cfile);
+       capture_session_init(&stuff.cap_sess, (void *)&stuff.cfile);
 #endif
 
 }
@@ -255,7 +255,7 @@ static char* intflist2json(GList* if_list, char** if_cap_err) {
             default:
                 g_string_append_printf(str,"'<type unknown %u>',", if_addr->ifat_type);
             }
-       
+
         }
 
            g_string_truncate(str,str->len - 1); /* the last comma or space (on empty list) */
@@ -282,11 +282,11 @@ static char* intflist2json(GList* if_list, char** if_cap_err) {
 
                                    data_link_info = (data_link_info_t *)lt_entry->data;
                                    g_string_append_printf(str,"{ name='%s', desc='%s' }, ", data_link_info->name, (data_link_info->description) ? data_link_info->description : "" );
-                               }                                   
+                               }
 
                                g_string_truncate(str,str->len - 2); /* the comma and space */
                                g_string_append(str,"]");
-                       }       
+                       }
 
                        g_string_append_printf(str,", can_set_rfmon=%s", caps->can_set_rfmon ? "1" : "0");
 
@@ -312,7 +312,7 @@ static char* intflist2json(GList* if_list, char** if_cap_err) {
 
                        free_if_capabilities(caps);
                }
-                 
+
         g_string_append(str,"},\n");
     }
 
@@ -329,8 +329,8 @@ static char* intf_list = NULL;
 static void get_interfaces(char** err) {
        int err_no = 0;
        GList* if_list;
-       
-       err = NULL;     
+
+       err = NULL;
        if_list = capture_interface_list(&err_no, err, NULL);
 
        if (err) {
@@ -377,7 +377,7 @@ static char* version_long_str = NULL;
 
 
 static char* param_get_long_version(char** err _U_) {
-       return g_strdup(version_long_str);
+       return g_strdup(version_long_str);
 }
 
 static char* param_get_version(char** err _U_) {
@@ -389,10 +389,10 @@ static char* param_get_capture_types(char** err _U_) {
   char* s;
   int i;
 
-  for (i = 0; i < WTAP_NUM_FILE_TYPES; i++) {
+  for (i = 0; i < WTAP_NUM_FILE_TYPES_SUBTYPES; i++) {
     if (wtap_dump_can_open(i)) {
       g_string_append_printf(str,"%s: %s\n",
-       wtap_file_type_short_string(i), wtap_file_type_string(i));
+       wtap_file_type_short_string(i), wtap_file_type_string(i));
     }
   }
 
@@ -484,11 +484,11 @@ static void preinit_epan(char* argv0, int (*main)(int, char **)) {
 
        error = init_progfile_dir(argv0, main);
 
-       comp_info_str = g_string_new("Compiled ");      
-       get_compiled_version_info(comp_info_str, NULL, epan_get_compiled_version_info);
+       comp_info_str = g_string_new("Compiled ");
+       get_compiled_version_info(comp_info_str, NULL, epan_get_compiled_version_info);
 
-       runtime_info_str = g_string_new("Running ");
-       get_runtime_version_info(runtime_info_str, NULL);
+       runtime_info_str = g_string_new("Running ");
+       get_runtime_version_info(runtime_info_str, NULL);
 
        version_long_str = g_strdup_printf("%s%s\n%s\n%s\n%s",
                version_str, wireshark_svnversion, get_copyright_info(),
@@ -503,13 +503,13 @@ static void preinit_epan(char* argv0, int (*main)(int, char **)) {
                wireshark_svnversion, comp_info_str->str, runtime_info_str->str);
 
        init_stuff();
-               
+
        capture_sync_set_fetch_dumpcap_pid_cb(set_dumpcap_pid);
 
-       init_process_policies();
+       init_process_policies();
 
        get_interfaces(&error);
-       
+
        if (error) {
                DISP_FATAL((CANNOT_PREINIT_EPAN,"Error getting interfaces: %s", error));
        }
@@ -561,7 +561,7 @@ void dispatcher_reaper(int sig) {
        struct dispatcher_child* cc = dispatcher->children;
        int max_children = dispatcher->max_children;
        int pid =  waitpid(-1, &status, WNOHANG);
-       int reqh_id_save =      dispatcher->reqh_id;
+       int reqh_id_save =      dispatcher->reqh_id;
 
        dispatcher->reqh_id = 0;
 
@@ -584,19 +584,19 @@ void dispatcher_reaper(int sig) {
 
                                if (WIFEXITED(status)) {
                                    s = g_strdup_printf(
-                                               "Unexpected dead: reason='exited' pid=%d status=%d",
-                                               pid, WEXITSTATUS(status));
+                                               "Unexpected dead: reason='exited' pid=%d status=%d",
+                                               pid, WEXITSTATUS(status));
                                } else if ( WIFSIGNALED(status) ) {
                                    s = g_strdup_printf(
-                                       "Unexpected dead: reason='signaled' pid=%d termsig=%d coredump=%s",
-                                       pid, WTERMSIG(status), WCOREDUMP(status) ? "yes":"no");
+                                       "Unexpected dead: reason='signaled' pid=%d termsig=%d coredump=%s",
+                                       pid, WTERMSIG(status), WCOREDUMP(status) ? "yes":"no");
 
                                        /*if (WCOREDUMP(status)) { system("analyze_coredump.sh pid=%d") } */
 
                                } else if (WIFSTOPPED(status)) {
                                    s = g_strdup_printf(
-                                       "Unexpected dead: reason='stopped' pid=%d stopsig=%d",
-                                       pid, WSTOPSIG(status));
+                                       "Unexpected dead: reason='stopped' pid=%d stopsig=%d",
+                                       pid, WSTOPSIG(status));
                                }
 
                                em = dispatcher->enc.to_parent->child_dead(s);
@@ -645,7 +645,7 @@ static long dispatch_to_parent(guint8* b, size_t len, echld_chld_id_t chld_id, e
        struct dispatcher_child* c = (struct dispatcher_child*)data;
 
        dispatcher->reqh_id = c->reqh_id = reqh_id;
-       
+
        in_ba.data = b;
        in_ba.len = (guint)len;
 
@@ -674,14 +674,14 @@ static long dispatch_to_parent(guint8* b, size_t len, echld_chld_id_t chld_id, e
                case ECHLD_EOF:
                case ECHLD_CAPTURE_STOPPED: CHLD_SET_STATE(c,DONE); break;
 
-               case ECHLD_NOTE_ADDED: break; 
+               case ECHLD_NOTE_ADDED: break;
                case ECHLD_PACKET_LIST: break;
                case ECHLD_FILE_SAVED: break;
 
                default:
                        goto misbehabing;
        }
-       
+
        DISP_DBG((4,"Dispatching to parent reqh_id=%d chld_id=%d type='%c'",reqh_id,c->chld_id,type));
        return DISP_WRITE(dispatcher->parent_out, &in_ba, chld_id, type, reqh_id);
 
@@ -694,13 +694,13 @@ misbehabing:
 
 }
 
-static struct timeval start_wait_time; 
+static struct timeval start_wait_time;
 static long start_wait_time_us = CHILD_START_WAIT_TIME;
 
 static void detach_new_child(enc_msg_t* em,  echld_chld_id_t chld_id) {
        struct dispatcher_child* c;
        int reqh_id = dispatcher->reqh_id;
-       int pid; 
+       int pid;
 
        if (( c = dispatcher_get_child(dispatcher, chld_id) )) {
                dispatcher_err(ECHLD_ERR_CHILD_EXISTS,"chld_id=%d exists already while creating new child",chld_id);
@@ -756,7 +756,7 @@ static void detach_new_child(enc_msg_t* em,  echld_chld_id_t chld_id) {
                                exit( echld_child_loop() );
 
                                /* it won't */
-                               return; 
+                               return;
                        }
                        default: {
                        /* I'm the parent */
@@ -809,7 +809,7 @@ static long dispatch_to_child(guint8* b, size_t len, echld_chld_id_t chld_id, ec
                        case ECHLD_CLOSE_CHILD:
                                dispatcher_destroy();
                                return 0;
-                       case ECHLD_PING: 
+                       case ECHLD_PING:
                                DISP_DBG((2,"PONG reqh_id=%d",reqh_id));
                                DISP_WRITE(dispatcher->parent_out, NULL, chld_id, ECHLD_PONG, reqh_id);
                                return 0;
@@ -848,7 +848,7 @@ static long dispatch_to_child(guint8* b, size_t len, echld_chld_id_t chld_id, ec
                                                g_free(err);
                                                return 0;
                                        }
-                                       
+
                                        ba = dispatcher->enc.to_parent->param(param,val);
                                        DISP_RESP(ba,ECHLD_PARAM);
                                        g_byte_array_free(ba,TRUE);
@@ -878,7 +878,7 @@ static long dispatch_to_child(guint8* b, size_t len, echld_chld_id_t chld_id, ec
                        }
                } else {
                        switch(type) {
-                               case ECHLD_CLOSE_CHILD: 
+                               case ECHLD_CLOSE_CHILD:
                                        CHLD_SET_STATE(c,CLOSED);
                                        goto relay_frame;
 
@@ -997,7 +997,7 @@ int dispatcher_loop(void) {
                                        kill(c->pid,SIGTERM);
                                        select(0,NULL,NULL,NULL,&wait_time);
                                        dispatcher_clear_child(c);
-                                       continue;       
+                                       continue;
                                }
 
                                if (FD_ISSET(c->reader.fd,&rfds)) {