Added missing "svn:keywords Id" and "svn:eol-style native" for some

c and h files.

svn path=/trunk/; revision=24290
This commit is contained in:
Stig Bjørlykke 2008-02-08 09:45:36 +00:00
parent 4284906aba
commit 42fe2398b9
16 changed files with 490 additions and 484 deletions

View File

@ -2,7 +2,7 @@
* Routines for E-UTRAN S1 Application Protocol (S1AP) packet dissection * Routines for E-UTRAN S1 Application Protocol (S1AP) packet dissection
* Copyright 2007, Anders Broman <anders.broman@ericsson.com> * Copyright 2007, Anders Broman <anders.broman@ericsson.com>
* *
* $Id: packet-s1ap-template.c 22778 2007-09-03 16:40:51Z etxrab $ * $Id$
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>

View File

@ -1,5 +1,5 @@
/* /*
* $Id: sttype-test.h 11400 2004-07-18 00:24:25Z guy $ * $Id$
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>

View File

@ -1,121 +1,121 @@
/* /*
* packet-bctp.c * packet-bctp.c
* Q.1990 BICC bearer control tunnelling protocol * Q.1990 BICC bearer control tunnelling protocol
* *
* (c) 2007, Luis E. Garcia Ontanon <luis.ontanon@gmail.com> * (c) 2007, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
* *
* $Id: $ * $Id$
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs * Copyright 1998 Gerald Combs
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* Ref ITU-T Rec. Q.1990 (07/2001) * Ref ITU-T Rec. Q.1990 (07/2001)
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#include <glib.h> #include <glib.h>
#include <epan/packet.h> #include <epan/packet.h>
#define PNAME "BCTP Q.1990" #define PNAME "BCTP Q.1990"
#define PSNAME "BCTP" #define PSNAME "BCTP"
#define PFNAME "bctp" #define PFNAME "bctp"
static int proto_bctp = -1; static int proto_bctp = -1;
static int hf_bctp_bvei = -1; static int hf_bctp_bvei = -1;
static int hf_bctp_bvi = -1; static int hf_bctp_bvi = -1;
static int hf_bctp_tpei = -1; static int hf_bctp_tpei = -1;
static int hf_bctp_tpi = -1; static int hf_bctp_tpi = -1;
static gint ett_bctp = -1; static gint ett_bctp = -1;
static dissector_table_t bctp_dissector_table; static dissector_table_t bctp_dissector_table;
static dissector_handle_t data_handle; static dissector_handle_t data_handle;
static dissector_handle_t text_handle; static dissector_handle_t text_handle;
/* /*
static const range_string tpi_vals[] = { static const range_string tpi_vals[] = {
{0x00,0x17,"spare (binary encoded protocols)"}, {0x00,0x17,"spare (binary encoded protocols)"},
{0x18,0x1f,"reserved for national use (binary encoded protocols)"}, {0x18,0x1f,"reserved for national use (binary encoded protocols)"},
{0x20,0x20,"IPBCP (text encoded)"}, {0x20,0x20,"IPBCP (text encoded)"},
{0x21,0x21,"spare (text encoded protocol)"}, {0x21,0x21,"spare (text encoded protocol)"},
{0x22,0x22,"not used"}, {0x22,0x22,"not used"},
{0x23,0x37,"spare (text encoded protocols)"}, {0x23,0x37,"spare (text encoded protocols)"},
{0x38,0x3f,"reserved for national use (text encoded protocols)"}, {0x38,0x3f,"reserved for national use (text encoded protocols)"},
{0,0,NULL} {0,0,NULL}
}; };
*/ */
static const value_string bvei_vals[] = { static const value_string bvei_vals[] = {
{0,"No indication"}, {0,"No indication"},
{0,"Version Error Indication, BCTP version not supported"}, {0,"Version Error Indication, BCTP version not supported"},
{0,NULL} {0,NULL}
}; };
static void dissect_bctp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { static void dissect_bctp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) {
proto_item* pi = proto_tree_add_item(tree, proto_bctp, tvb,0,2, FALSE); proto_item* pi = proto_tree_add_item(tree, proto_bctp, tvb,0,2, FALSE);
proto_tree* pt = proto_item_add_subtree(pi,ett_bctp); proto_tree* pt = proto_item_add_subtree(pi,ett_bctp);
tvbuff_t* sub_tvb = tvb_new_subset(tvb, 2, -1, -1); tvbuff_t* sub_tvb = tvb_new_subset(tvb, 2, -1, -1);
guint8 tpi = tvb_get_guint8(tvb,1) & 0x3f; guint8 tpi = tvb_get_guint8(tvb,1) & 0x3f;
proto_tree_add_item(pt, hf_bctp_bvei, tvb,0,2, FALSE); proto_tree_add_item(pt, hf_bctp_bvei, tvb,0,2, FALSE);
proto_tree_add_item(pt, hf_bctp_bvi, tvb,0,2, FALSE); proto_tree_add_item(pt, hf_bctp_bvi, tvb,0,2, FALSE);
proto_tree_add_item(pt, hf_bctp_tpei, tvb,0,2, FALSE); proto_tree_add_item(pt, hf_bctp_tpei, tvb,0,2, FALSE);
proto_tree_add_item(pt, hf_bctp_tpi, tvb,0,2, FALSE); proto_tree_add_item(pt, hf_bctp_tpi, tvb,0,2, FALSE);
if ( dissector_try_port(bctp_dissector_table, tpi, sub_tvb, pinfo, tree) ) { if ( dissector_try_port(bctp_dissector_table, tpi, sub_tvb, pinfo, tree) ) {
return; return;
} else if (tpi <= 0x22) { } else if (tpi <= 0x22) {
call_dissector(data_handle,sub_tvb, pinfo, tree); call_dissector(data_handle,sub_tvb, pinfo, tree);
} else { } else {
/* tpi > 0x22 */ /* tpi > 0x22 */
call_dissector(text_handle,sub_tvb, pinfo, tree); call_dissector(text_handle,sub_tvb, pinfo, tree);
} }
} }
void void
proto_register_bctp (void) proto_register_bctp (void)
{ {
static hf_register_info hf[] = { static hf_register_info hf[] = {
{&hf_bctp_bvei, {"BVEI", "bctp.bvei", FT_UINT16, BASE_HEX, VALS(bvei_vals), 0x4000, "BCTP Version Error Indicator", HFILL }}, {&hf_bctp_bvei, {"BVEI", "bctp.bvei", FT_UINT16, BASE_HEX, VALS(bvei_vals), 0x4000, "BCTP Version Error Indicator", HFILL }},
{&hf_bctp_bvi, {"BVI", "bctp.bvi", FT_UINT16, BASE_HEX, NULL, 0x1F00, "BCTP Version Indicator", HFILL }}, {&hf_bctp_bvi, {"BVI", "bctp.bvi", FT_UINT16, BASE_HEX, NULL, 0x1F00, "BCTP Version Indicator", HFILL }},
{&hf_bctp_tpei, {"TPEI", "bctp.tpei", FT_UINT16, BASE_HEX, NULL, 0x0040, "Tunnelled Protocol Error Indicator", HFILL }}, {&hf_bctp_tpei, {"TPEI", "bctp.tpei", FT_UINT16, BASE_HEX, NULL, 0x0040, "Tunnelled Protocol Error Indicator", HFILL }},
{&hf_bctp_tpi, {"TPI", "bctp.tpi", FT_UINT16, BASE_HEX, NULL, 0x003F, "Tunnelled Protocol Indicator", HFILL }}, {&hf_bctp_tpi, {"TPI", "bctp.tpi", FT_UINT16, BASE_HEX, NULL, 0x003F, "Tunnelled Protocol Indicator", HFILL }},
}; };
static gint *ett[] = { static gint *ett[] = {
&ett_bctp &ett_bctp
}; };
proto_bctp = proto_register_protocol(PNAME, PSNAME, PFNAME); proto_bctp = proto_register_protocol(PNAME, PSNAME, PFNAME);
proto_register_field_array(proto_bctp, hf, array_length(hf)); proto_register_field_array(proto_bctp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett)); proto_register_subtree_array(ett, array_length(ett));
register_dissector("bctp", dissect_bctp, proto_bctp); register_dissector("bctp", dissect_bctp, proto_bctp);
bctp_dissector_table = register_dissector_table("bctp.tpi", "BCTP Tunnelled Protocol Indicator", FT_UINT32, BASE_DEC); bctp_dissector_table = register_dissector_table("bctp.tpi", "BCTP Tunnelled Protocol Indicator", FT_UINT32, BASE_DEC);
} }
void void
proto_reg_handoff_bctp(void) proto_reg_handoff_bctp(void)
{ {
data_handle = find_dissector("data"); data_handle = find_dissector("data");
text_handle = find_dissector("data-text-lines"); text_handle = find_dissector("data-text-lines");
} }

View File

@ -4,7 +4,7 @@
* CIGI - http://cigi.sourceforge.net/ * CIGI - http://cigi.sourceforge.net/
* Copyright (c) 2005 The Boeing Company * Copyright (c) 2005 The Boeing Company
* *
* $Id: README.developer 15753 2005-09-10 19:43:41Z guy $ * $Id$
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>

View File

@ -6,7 +6,7 @@
* *
* Francesco Fondelli <francesco dot fondelli, gmail dot com> * Francesco Fondelli <francesco dot fondelli, gmail dot com>
* *
* $Id: README.developer 11973 2004-09-11 23:10:14Z guy $ * $Id$
* *
* template taken from packet-udp.c * template taken from packet-udp.c
* *

View File

@ -3,7 +3,7 @@
* *
* metatech <metatech@flashmail.com> * metatech <metatech@flashmail.com>
* *
* $Id: packet-drda.c 18196 2006-05-21 04:49:01Z sahlberg $ * $Id$
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>

View File

@ -1,6 +1,8 @@
/* packet-erf.c /* packet-erf.c
* Routines for ERF encapsulation dissection * Routines for ERF encapsulation dissection
* *
* $Id$
*
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs * Copyright 1998 Gerald Combs

View File

@ -4,7 +4,7 @@
* Greg Morris <gmorris@novell.com> * Greg Morris <gmorris@novell.com>
* Copyright (c) Novell, Inc. 2002-2003 * Copyright (c) Novell, Inc. 2002-2003
* *
* $Id: packet-ncp-sss.c,v 1.00 2003/06/26 11:36:14 guy Exp $ * $Id$
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>

View File

@ -3,7 +3,7 @@
* Greg Morris <gmorris@novell.com> * Greg Morris <gmorris@novell.com>
* Copyright (c) Novell, Inc. 2002-2004 * Copyright (c) Novell, Inc. 2002-2004
* *
* $Id: packet-ncp-sss.h,v 1.0 2004/02/29 08:01:22 guy Exp $ * $Id$
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>

View File

@ -1,7 +1,7 @@
/* packet-telkonet.c /* packet-telkonet.c
* Routines for ethertype 0x88A1 tunneling dissection * Routines for ethertype 0x88A1 tunneling dissection
* *
* $Id: packet-telkonet.c 18196 2006-05-21 04:49:01Z sahlberg $ * $Id$
* *
* Copyright 2006 Joerg Mayer (see AUTHORS file) * Copyright 2006 Joerg Mayer (see AUTHORS file)
* *

View File

@ -1,7 +1,7 @@
/* conversations_ncp.c 2005 Greg Morris /* conversations_ncp.c 2005 Greg Morris
* modified from conversations_eth.c 2003 Ronnie Sahlberg * modified from conversations_eth.c 2003 Ronnie Sahlberg
* *
* $Id: conversations_wlan.c 15501 2005-08-21 19:24:11Z guy $ * $Id$
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>

View File

@ -1,6 +1,8 @@
/* conversations_rsvp.c /* conversations_rsvp.c
* conversations_rsvp.c August 2005, Manu Pathak <mapathak@cisco.com> * conversations_rsvp.c August 2005, Manu Pathak <mapathak@cisco.com>
* *
* $Id$
*
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs * Copyright 1998 Gerald Combs

View File

@ -1,6 +1,8 @@
/* hostlist_rsvp.c /* hostlist_rsvp.c
* hostlist_rsvp.c August 2005, Manu Pathak <mapathak@cisco.com> * hostlist_rsvp.c August 2005, Manu Pathak <mapathak@cisco.com>
* *
* $Id$
*
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs * Copyright 1998 Gerald Combs

View File

@ -1,7 +1,7 @@
/* ncp_stat.c /* ncp_stat.c
* ncp_stat 2005 Greg Morris * ncp_stat 2005 Greg Morris
* *
* $Id: ncp_stat.c 00000 2005-09-22 11:09:36Z xxx $ * $Id$
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>

View File

@ -1,7 +1,7 @@
/* scsi_stat.c /* scsi_stat.c
* scsi_stat 2006 Ronnie Sahlberg * scsi_stat 2006 Ronnie Sahlberg
* *
* $Id: scsi_stat.c 17252 2006-02-11 13:05:24Z lego $ * $Id$
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>

704
update.c
View File

@ -1,352 +1,352 @@
/* update.c /* update.c
* *
* $Id: update.c 19935 2006-11-19 23:23:53Z gerald $ * $Id$
* *
* Wireshark - Network traffic analyzer * Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org> * By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs * Copyright 1998 Gerald Combs
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#include <glib.h> #include <glib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <epan/prefs.h> #include <epan/prefs.h>
#include <epan/prefs-int.h> #include <epan/prefs-int.h>
#include <epan/filesystem.h> #include <epan/filesystem.h>
#include "simple_dialog.h" #include "simple_dialog.h"
#include "version_info.h" #include "version_info.h"
#ifdef HAVE_LIBPCAP #ifdef HAVE_LIBPCAP
#include "capture-pcap-util.h" #include "capture-pcap-util.h"
#endif #endif
#include "file_util.h" #include "file_util.h"
#include <wininet.h> #include <wininet.h>
#include "nio-ie5.h" #include "nio-ie5.h"
/* update information about a single component */ /* update information about a single component */
typedef struct update_info_s { typedef struct update_info_s {
char *prefix; /* prefix of the update file keys */ char *prefix; /* prefix of the update file keys */
gboolean needs_update; /* does this component need an update */ gboolean needs_update; /* does this component need an update */
char *version_installed; /* the version currently installed */ char *version_installed; /* the version currently installed */
char *title; /* the component title (name) */ char *title; /* the component title (name) */
char *description; /* description of the component */ char *description; /* description of the component */
char *version_recommended; /* the version recommended */ char *version_recommended; /* the version recommended */
char *url; /* the URL for an update */ char *url; /* the URL for an update */
char *md5; /* md5 checksum for that update */ char *md5; /* md5 checksum for that update */
char *size; /* size of that update */ char *size; /* size of that update */
} update_info_t; } update_info_t;
/* download a complete file from the internet */ /* download a complete file from the internet */
int int
download_file(const char *url, const char *filename) { download_file(const char *url, const char *filename) {
netio_ie5_t * conn; netio_ie5_t * conn;
char buf[100]; char buf[100];
int chunk_len; int chunk_len;
int fd; int fd;
int stream_len; int stream_len;
int ret = 0; int ret = 0;
/* open output file */ /* open output file */
fd = eth_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); fd = eth_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if(fd == -1) { if(fd == -1) {
g_warning("Couldn't open output file %s!", filename); g_warning("Couldn't open output file %s!", filename);
return -1; return -1;
} }
/* connect to url */ /* connect to url */
conn = netio_ie5_connect (url); conn = netio_ie5_connect (url);
if (conn == NULL) { if (conn == NULL) {
g_warning("Couldn't connect to %s!", url); g_warning("Couldn't connect to %s!", url);
return -1; return -1;
} }
do { do {
/* XXX - maybe add a progress bar here */ /* XXX - maybe add a progress bar here */
/* read some bytes from the url */ /* read some bytes from the url */
chunk_len = netio_ie5_read (conn, buf, sizeof(buf)); chunk_len = netio_ie5_read (conn, buf, sizeof(buf));
/* write bytes to the output file */ /* write bytes to the output file */
stream_len = eth_write( fd, buf, chunk_len); stream_len = eth_write( fd, buf, chunk_len);
if(stream_len != chunk_len) { if(stream_len != chunk_len) {
g_warning("output failed: stream_len %u != chunk_len %u", stream_len, chunk_len); g_warning("output failed: stream_len %u != chunk_len %u", stream_len, chunk_len);
ret = -1; ret = -1;
break; break;
} }
} while(chunk_len > 0); } while(chunk_len > 0);
netio_ie5_disconnect(conn); netio_ie5_disconnect(conn);
eth_close(fd); eth_close(fd);
return ret; return ret;
} }
update_info_t * update_info_t *
update_info_new(void) update_info_new(void)
{ {
return g_malloc0(sizeof(update_info_t)); return g_malloc0(sizeof(update_info_t));
} }
void void
update_info_delete(update_info_t *update_info) update_info_delete(update_info_t *update_info)
{ {
if(update_info->prefix) if(update_info->prefix)
g_free(update_info->prefix); g_free(update_info->prefix);
if(update_info->version_installed) if(update_info->version_installed)
g_free(update_info->version_installed); g_free(update_info->version_installed);
if(update_info->title) if(update_info->title)
g_free(update_info->title); g_free(update_info->title);
if(update_info->description) if(update_info->description)
g_free(update_info->description); g_free(update_info->description);
if(update_info->version_recommended) if(update_info->version_recommended)
g_free(update_info->version_recommended); g_free(update_info->version_recommended);
if(update_info->url) if(update_info->url)
g_free(update_info->url); g_free(update_info->url);
if(update_info->md5) if(update_info->md5)
g_free(update_info->md5); g_free(update_info->md5);
if(update_info->size) if(update_info->size)
g_free(update_info->size); g_free(update_info->size);
g_free(update_info); g_free(update_info);
} }
/* check a single key value pair */ /* check a single key value pair */
static void static void
update_pref_check(gchar *pref_name, gchar *value, char *check_prefix, char *check_name, char **check_value) update_pref_check(gchar *pref_name, gchar *value, char *check_prefix, char *check_name, char **check_value)
{ {
GString *check = g_string_new(check_prefix); GString *check = g_string_new(check_prefix);
g_string_append(check, check_name); g_string_append(check, check_name);
if(strcmp(pref_name, check->str) == 0) { if(strcmp(pref_name, check->str) == 0) {
if(*check_value) if(*check_value)
/* there shouldn't be a duplicate entry in the update file */ /* there shouldn't be a duplicate entry in the update file */
g_warning("Duplicate of %s: current %s former %s", pref_name, value, *check_value); g_warning("Duplicate of %s: current %s former %s", pref_name, value, *check_value);
else else
*check_value = g_strdup(value); *check_value = g_strdup(value);
} }
g_string_free(check, TRUE); g_string_free(check, TRUE);
} }
/* a new key value pair from the update file */ /* a new key value pair from the update file */
static prefs_set_pref_e static prefs_set_pref_e
update_pref(gchar *pref_name, gchar *value, void *private_data) update_pref(gchar *pref_name, gchar *value, void *private_data)
{ {
update_info_t *update_info = private_data; update_info_t *update_info = private_data;
update_pref_check(pref_name, value, update_info->prefix, "title", &update_info->title); update_pref_check(pref_name, value, update_info->prefix, "title", &update_info->title);
update_pref_check(pref_name, value, update_info->prefix, "description", &update_info->description); update_pref_check(pref_name, value, update_info->prefix, "description", &update_info->description);
update_pref_check(pref_name, value, update_info->prefix, "version", &update_info->version_recommended); update_pref_check(pref_name, value, update_info->prefix, "version", &update_info->version_recommended);
update_pref_check(pref_name, value, update_info->prefix, "update.url", &update_info->url); update_pref_check(pref_name, value, update_info->prefix, "update.url", &update_info->url);
update_pref_check(pref_name, value, update_info->prefix, "update.md5", &update_info->md5); update_pref_check(pref_name, value, update_info->prefix, "update.md5", &update_info->md5);
update_pref_check(pref_name, value, update_info->prefix, "update.size", &update_info->size); update_pref_check(pref_name, value, update_info->prefix, "update.size", &update_info->size);
return PREFS_SET_OK; return PREFS_SET_OK;
} }
/* display an update_info */ /* display an update_info */
static void static void
update_info_display(update_info_t *update_info) update_info_display(update_info_t *update_info)
{ {
GString *overview; GString *overview;
overview = g_string_new(""); overview = g_string_new("");
if(update_info->title) { if(update_info->title) {
g_string_append_printf(overview, "%s%s%s", g_string_append_printf(overview, "%s%s%s",
simple_dialog_primary_start(), update_info->title, simple_dialog_primary_end()); simple_dialog_primary_start(), update_info->title, simple_dialog_primary_end());
} else { } else {
g_string_append_printf(overview, "%sComponent%s", g_string_append_printf(overview, "%sComponent%s",
simple_dialog_primary_start(), simple_dialog_primary_end()); simple_dialog_primary_start(), simple_dialog_primary_end());
} }
g_string_append(overview, "\n\n"); g_string_append(overview, "\n\n");
if(update_info->description) if(update_info->description)
g_string_append_printf(overview, "%s\n\n", update_info->description); g_string_append_printf(overview, "%s\n\n", update_info->description);
g_string_append_printf(overview, "Installed: %s\n", update_info->version_installed); g_string_append_printf(overview, "Installed: %s\n", update_info->version_installed);
if(update_info->version_recommended) if(update_info->version_recommended)
g_string_append_printf(overview, "Recommended: %s\n", update_info->version_recommended); g_string_append_printf(overview, "Recommended: %s\n", update_info->version_recommended);
else else
g_string_append(overview, "Recommenced: unknown\n"); g_string_append(overview, "Recommenced: unknown\n");
if(update_info->version_recommended && update_info->url) if(update_info->version_recommended && update_info->url)
g_string_append_printf(overview, "From: %s\n", update_info->url); g_string_append_printf(overview, "From: %s\n", update_info->url);
if(update_info->size) if(update_info->size)
g_string_append_printf(overview, "Size: %s", update_info->size); g_string_append_printf(overview, "Size: %s", update_info->size);
simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK, overview->str); simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK, overview->str);
g_string_free(overview, TRUE); g_string_free(overview, TRUE);
} }
/* check the version of the wireshark program */ /* check the version of the wireshark program */
static update_info_t * static update_info_t *
update_check_wireshark(const char *local_file) update_check_wireshark(const char *local_file)
{ {
FILE *pf; FILE *pf;
update_info_t *update_info = update_info_new(); update_info_t *update_info = update_info_new();
update_info->version_installed = g_strdup(VERSION); update_info->version_installed = g_strdup(VERSION);
update_info->prefix = "wireshark.setup."; update_info->prefix = "wireshark.setup.";
pf = eth_fopen(local_file, "r"); pf = eth_fopen(local_file, "r");
if(pf != NULL) { if(pf != NULL) {
/* read in update_info of Wireshark */ /* read in update_info of Wireshark */
read_prefs_file(local_file, pf, update_pref, update_info); read_prefs_file(local_file, pf, update_pref, update_info);
fclose(pf); fclose(pf);
/* check if Wireshark needs an update */ /* check if Wireshark needs an update */
if(update_info->version_installed && update_info->version_recommended && if(update_info->version_installed && update_info->version_recommended &&
strcmp(update_info->version_installed, update_info->version_recommended) != 0) strcmp(update_info->version_installed, update_info->version_recommended) != 0)
{ {
update_info->needs_update = TRUE; update_info->needs_update = TRUE;
} }
} else { } else {
g_warning("Could not open %s", local_file); g_warning("Could not open %s", local_file);
} }
return update_info; return update_info;
} }
/* check the version of winpcap */ /* check the version of winpcap */
static update_info_t * static update_info_t *
update_check_winpcap(const char *local_file) update_check_winpcap(const char *local_file)
{ {
FILE *pf; FILE *pf;
update_info_t * update_info = update_info_new(); update_info_t * update_info = update_info_new();
GString *pcap_version_tmp; GString *pcap_version_tmp;
char *pcap_version = NULL; char *pcap_version = NULL;
char *pcap_vstart; char *pcap_vstart;
char *pcap_vend; char *pcap_vend;
update_info->prefix = "winpcap."; update_info->prefix = "winpcap.";
pf = eth_fopen(local_file, "r"); pf = eth_fopen(local_file, "r");
if(pf != NULL) { if(pf != NULL) {
/* read in update_info of WinPcap */ /* read in update_info of WinPcap */
read_prefs_file(local_file, pf, update_pref, update_info); read_prefs_file(local_file, pf, update_pref, update_info);
fclose(pf); fclose(pf);
/* get WinPcap version */ /* get WinPcap version */
/* XXX - what's the "approved" method to get the WinPcap version? */ /* XXX - what's the "approved" method to get the WinPcap version? */
pcap_version_tmp = g_string_new(""); pcap_version_tmp = g_string_new("");
get_runtime_pcap_version(pcap_version_tmp); get_runtime_pcap_version(pcap_version_tmp);
/* cut out real version from "combined" version string */ /* cut out real version from "combined" version string */
pcap_vstart = strstr(pcap_version_tmp->str, "with WinPcap version "); pcap_vstart = strstr(pcap_version_tmp->str, "with WinPcap version ");
if(pcap_vstart != NULL) { if(pcap_vstart != NULL) {
pcap_vstart += sizeof("with WinPcap version"); pcap_vstart += sizeof("with WinPcap version");
pcap_vend = strstr(pcap_vstart, " "); pcap_vend = strstr(pcap_vstart, " ");
if(pcap_vend != NULL) { if(pcap_vend != NULL) {
pcap_vend[0] = 0; pcap_vend[0] = 0;
pcap_version = g_strdup(pcap_vstart); pcap_version = g_strdup(pcap_vstart);
} }
} }
update_info->version_installed = g_strdup(pcap_version); update_info->version_installed = g_strdup(pcap_version);
if(pcap_version && update_info->version_recommended && if(pcap_version && update_info->version_recommended &&
strcmp(pcap_version, update_info->version_recommended) != 0) strcmp(pcap_version, update_info->version_recommended) != 0)
{ {
update_info->needs_update = TRUE; update_info->needs_update = TRUE;
} }
} else { } else {
g_warning("Could not open %s", local_file); g_warning("Could not open %s", local_file);
} }
g_string_free(pcap_version_tmp, TRUE); g_string_free(pcap_version_tmp, TRUE);
if(pcap_version) if(pcap_version)
g_free(pcap_version); g_free(pcap_version);
return update_info; return update_info;
} }
/* check for all updates */ /* check for all updates */
void void
update_check(gboolean interactive) update_check(gboolean interactive)
{ {
char *local_file; char *local_file;
const char *url_file = "http://127.0.0.1/wsupdate"; /* XXX - build the URL depending on platform, versions, ... */ const char *url_file = "http://127.0.0.1/wsupdate"; /* XXX - build the URL depending on platform, versions, ... */
update_info_t *update_info_wireshark; update_info_t *update_info_wireshark;
update_info_t *update_info_winpcap; update_info_t *update_info_winpcap;
/* build update file name */ /* build update file name */
/* XXX - using the personal path, use temp dir instead? */ /* XXX - using the personal path, use temp dir instead? */
local_file = get_persconffile_path("wsupdate", FALSE, TRUE /*for_writing*/); local_file = get_persconffile_path("wsupdate", FALSE, TRUE /*for_writing*/);
if(local_file == NULL) { if(local_file == NULL) {
g_warning("Couldn't create output path!"); g_warning("Couldn't create output path!");
return; return;
} }
/* download update file */ /* download update file */
if(download_file(url_file, local_file) == -1) { if(download_file(url_file, local_file) == -1) {
g_warning("Couldn't download update file: %s", local_file); g_warning("Couldn't download update file: %s", local_file);
g_free(local_file); g_free(local_file);
return; return;
} }
/* check wireshark */ /* check wireshark */
update_info_wireshark = update_check_wireshark(local_file); update_info_wireshark = update_check_wireshark(local_file);
/* check winpcap */ /* check winpcap */
update_info_winpcap = update_check_winpcap(local_file); update_info_winpcap = update_check_winpcap(local_file);
/* display results */ /* display results */
if(update_info_wireshark->needs_update || update_info_winpcap->needs_update) { if(update_info_wireshark->needs_update || update_info_winpcap->needs_update) {
if(update_info_wireshark->needs_update) if(update_info_wireshark->needs_update)
update_info_display(update_info_wireshark); update_info_display(update_info_wireshark);
if(update_info_winpcap->needs_update) if(update_info_winpcap->needs_update)
update_info_display(update_info_winpcap); update_info_display(update_info_winpcap);
} else { } else {
if(interactive) { if(interactive) {
simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK, "No updates available"); simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK, "No updates available");
} }
} }
/* cleanup */ /* cleanup */
update_info_delete(update_info_wireshark); update_info_delete(update_info_wireshark);
update_info_delete(update_info_winpcap); update_info_delete(update_info_winpcap);
g_free(local_file); g_free(local_file);
} }