2003-02-18 21:47:56 +00:00
|
|
|
/* packet-rsync.c
|
|
|
|
* Routines for rsync dissection
|
|
|
|
* [ very rough, but mininally functional ]
|
|
|
|
* Copyright 2003, Brad Hards <bradh@frogmouth.net>
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2003-02-18 21:47:56 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2003-02-18 21:47:56 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program 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.
|
2010-05-13 18:28:34 +00:00
|
|
|
*
|
2003-02-18 21:47:56 +00:00
|
|
|
* This program 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.
|
2010-05-13 18:28:34 +00:00
|
|
|
*
|
2003-02-18 21:47:56 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 23:18:38 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2003-02-18 21:47:56 +00:00
|
|
|
*/
|
|
|
|
|
2013-10-18 21:11:11 +00:00
|
|
|
#define NEW_PROTO_TREE_API
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
#include <string.h>
|
2012-05-15 19:23:35 +00:00
|
|
|
|
2003-02-18 21:47:56 +00:00
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/strutil.h>
|
|
|
|
#include <epan/conversation.h>
|
2013-09-15 21:36:37 +00:00
|
|
|
#include <epan/wmem/wmem.h>
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
#define RSYNCD_MAGIC_HEADER "@RSYNCD:"
|
|
|
|
#define RSYNCD_MAGIC_HEADER_LEN 8
|
|
|
|
|
|
|
|
#define RSYNCD_AUTHREQD "@RSYNCD: AUTHREQD "
|
|
|
|
#define RSYNCD_AUTHREQD_LEN 18
|
|
|
|
|
|
|
|
#define RSYNCD_EXIT "@RSYNCD: EXIT"
|
|
|
|
#define RSYNCD_EXIT_LEN 13
|
|
|
|
|
|
|
|
#define RSYNC_MODULE_LIST_QUERY "\n"
|
|
|
|
#define RSYNC_MODULE_LIST_QUERY_LEN 1
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
/* what states make sense here ? */
|
|
|
|
typedef enum _rsync_state {
|
2013-06-13 01:06:31 +00:00
|
|
|
RSYNC_INIT = 0,
|
|
|
|
RSYNC_SERV_INIT = 1,
|
|
|
|
RSYNC_CLIENT_QUERY = 2,
|
|
|
|
RSYNC_MODULE_LIST = 4,
|
|
|
|
RSYNC_COMMAND = 5,
|
|
|
|
RSYNC_SERV_MOTD = 6,
|
|
|
|
RSYNC_DATA = 7
|
2003-02-18 21:47:56 +00:00
|
|
|
} rsync_state_t;
|
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
enum rsync_who {
|
|
|
|
CLIENT,
|
|
|
|
SERVER
|
|
|
|
};
|
|
|
|
|
2003-02-18 21:47:56 +00:00
|
|
|
static gboolean rsync_desegment = TRUE;
|
|
|
|
|
|
|
|
/* this is a guide to the current conversation state */
|
|
|
|
struct rsync_conversation_data {
|
2013-06-13 01:06:31 +00:00
|
|
|
rsync_state_t client_state;
|
|
|
|
rsync_state_t server_state;
|
2003-02-18 21:47:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct rsync_frame_data {
|
|
|
|
rsync_state_t state;
|
|
|
|
};
|
|
|
|
|
2013-10-18 21:11:11 +00:00
|
|
|
static header_field_info *hfi_rsync = NULL;
|
|
|
|
|
|
|
|
#define RSYNC_HF_INIT HFI_INIT(proto_rsync)
|
|
|
|
|
|
|
|
static header_field_info hfi_rsync_hdr_magic RSYNC_HF_INIT =
|
|
|
|
{"Magic Header", "rsync.hdr_magic",
|
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
|
|
|
|
|
|
|
|
static header_field_info hfi_rsync_hdr_version RSYNC_HF_INIT =
|
|
|
|
{"Header Version", "rsync.hdr_version",
|
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
|
|
|
|
|
|
|
|
static header_field_info hfi_rsync_query_string RSYNC_HF_INIT =
|
|
|
|
{"Client Query String", "rsync.query",
|
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-10-18 21:11:11 +00:00
|
|
|
static header_field_info hfi_rsync_motd_string RSYNC_HF_INIT =
|
|
|
|
{"Server MOTD String", "rsync.motd",
|
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
|
|
|
|
|
|
|
|
static header_field_info hfi_rsync_module_list_string RSYNC_HF_INIT =
|
|
|
|
{"Server Module List", "rsync.module_list",
|
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
|
|
|
|
|
|
|
|
static header_field_info hfi_rsync_rsyncdok_string RSYNC_HF_INIT =
|
|
|
|
{"RSYNCD Response String", "rsync.response",
|
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
|
|
|
|
|
|
|
|
static header_field_info hfi_rsync_command_string RSYNC_HF_INIT =
|
|
|
|
{"Client Command String", "rsync.command",
|
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
|
|
|
|
|
|
|
|
static header_field_info hfi_rsync_data RSYNC_HF_INIT =
|
|
|
|
{"rsync data", "rsync.data",
|
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL };
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
static gint ett_rsync = -1;
|
|
|
|
|
2006-12-07 20:34:08 +00:00
|
|
|
static dissector_handle_t rsync_handle;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define TCP_PORT_RSYNC 873
|
|
|
|
|
2008-10-27 20:34:44 +00:00
|
|
|
static guint glb_rsync_tcp_port = TCP_PORT_RSYNC;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
static void
|
2013-06-13 01:06:31 +00:00
|
|
|
dissect_rsync_version_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *rsync_tree, enum rsync_who me)
|
|
|
|
{
|
|
|
|
int offset = 0;
|
|
|
|
gchar version[5]; /* 2 digits for main version; '.'; 1 digit for sub version; NULL */
|
2013-10-18 21:11:11 +00:00
|
|
|
proto_tree_add_item(rsync_tree, &hfi_rsync_hdr_magic, tvb, offset, RSYNCD_MAGIC_HEADER_LEN, ENC_ASCII|ENC_NA);
|
2013-06-13 01:06:31 +00:00
|
|
|
offset += RSYNCD_MAGIC_HEADER_LEN;
|
|
|
|
offset++; /* skip the space */
|
2013-10-18 21:11:11 +00:00
|
|
|
proto_tree_add_item(rsync_tree, &hfi_rsync_hdr_version, tvb, offset, sizeof(version)-1, ENC_ASCII|ENC_NA);
|
2013-06-13 01:06:31 +00:00
|
|
|
tvb_get_nstringz0(tvb, offset, sizeof(version), version);
|
|
|
|
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "%s Initialisation (Version %s)", (me == SERVER ? "Server" : "Client"), version);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Packet dissection routine called by tcp (& udp) when port 873 detected */
|
|
|
|
static int
|
2003-02-18 21:47:56 +00:00
|
|
|
dissect_rsync_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
2003-07-08 04:06:26 +00:00
|
|
|
gboolean desegment _U_)
|
2003-02-18 21:47:56 +00:00
|
|
|
{
|
|
|
|
conversation_t *conversation;
|
|
|
|
struct rsync_conversation_data *conversation_data;
|
2010-01-19 23:51:27 +00:00
|
|
|
struct rsync_frame_data *rsync_frame_data_p;
|
2003-02-18 21:47:56 +00:00
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *rsync_tree;
|
2013-06-13 01:06:31 +00:00
|
|
|
enum rsync_who me;
|
2003-02-18 21:47:56 +00:00
|
|
|
int offset = 0;
|
|
|
|
guint buff_length;
|
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RSYNC");
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
me = pinfo->srcport == glb_rsync_tcp_port ? SERVER : CLIENT;
|
|
|
|
|
2010-05-13 18:28:34 +00:00
|
|
|
conversation = find_or_create_conversation(pinfo);
|
2003-03-01 14:12:38 +00:00
|
|
|
|
2013-10-18 21:11:11 +00:00
|
|
|
conversation_data = (struct rsync_conversation_data *)conversation_get_proto_data(conversation, hfi_rsync->id);
|
2003-03-01 14:12:38 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
if (conversation_data == NULL) { /* new conversation */
|
2013-09-15 21:36:37 +00:00
|
|
|
conversation_data = wmem_new(wmem_file_scope(), struct rsync_conversation_data);
|
2013-06-13 01:06:31 +00:00
|
|
|
conversation_data->client_state = RSYNC_INIT;
|
|
|
|
conversation_data->server_state = RSYNC_SERV_INIT;
|
2013-10-18 21:11:11 +00:00
|
|
|
conversation_add_proto_data(conversation, hfi_rsync->id, conversation_data);
|
2003-02-18 21:47:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
conversation_set_dissector(conversation, rsync_handle);
|
2010-05-13 18:28:34 +00:00
|
|
|
|
2013-10-18 21:11:11 +00:00
|
|
|
ti = proto_tree_add_item(tree, hfi_rsync, tvb, 0, -1, ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
rsync_tree = proto_item_add_subtree(ti, ett_rsync);
|
|
|
|
|
2013-11-23 02:20:13 +00:00
|
|
|
rsync_frame_data_p = (struct rsync_frame_data *)p_get_proto_data(wmem_file_scope(), pinfo, hfi_rsync->id, 0);
|
2010-01-19 23:51:27 +00:00
|
|
|
if (!rsync_frame_data_p) {
|
2013-06-13 01:06:31 +00:00
|
|
|
/* then we haven't seen this frame before */
|
2013-09-15 21:36:37 +00:00
|
|
|
rsync_frame_data_p = wmem_new(wmem_file_scope(), struct rsync_frame_data);
|
2013-06-13 01:06:31 +00:00
|
|
|
rsync_frame_data_p->state = (me == SERVER) ? conversation_data->server_state : conversation_data->client_state;
|
2013-11-23 02:20:13 +00:00
|
|
|
p_add_proto_data(wmem_file_scope(), pinfo, hfi_rsync->id, 0, rsync_frame_data_p);
|
2003-02-18 21:47:56 +00:00
|
|
|
}
|
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
if (me == SERVER) {
|
2010-01-19 23:51:27 +00:00
|
|
|
switch (rsync_frame_data_p->state) {
|
2013-06-13 01:06:31 +00:00
|
|
|
case RSYNC_SERV_INIT:
|
|
|
|
dissect_rsync_version_header(tvb, pinfo, rsync_tree, me);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
conversation_data->server_state = RSYNC_SERV_MOTD;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
break;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
case RSYNC_SERV_MOTD:
|
2013-10-18 21:11:11 +00:00
|
|
|
proto_tree_add_item(rsync_tree, &hfi_rsync_motd_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "Server MOTD");
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
conversation_data->server_state = RSYNC_SERV_MOTD;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
break;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
case RSYNC_MODULE_LIST:
|
|
|
|
/* there are two cases - file list, or authentication */
|
|
|
|
if (0 == tvb_strneql(tvb, offset, RSYNCD_AUTHREQD, RSYNCD_AUTHREQD_LEN)) {
|
|
|
|
/* matches, so we assume its an authentication message */
|
2013-10-18 21:11:11 +00:00
|
|
|
proto_tree_add_item(rsync_tree, &hfi_rsync_rsyncdok_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "Authentication");
|
|
|
|
conversation_data->server_state = RSYNC_DATA;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
} else { /* it didn't match, so it is probably a module list */
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-10-18 21:11:11 +00:00
|
|
|
proto_tree_add_item(rsync_tree, &hfi_rsync_module_list_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
/* we need to check the end of the buffer for magic string */
|
|
|
|
buff_length = tvb_length_remaining(tvb, offset);
|
|
|
|
if (buff_length > RSYNCD_EXIT_LEN &&
|
|
|
|
0 == tvb_strneql(tvb, buff_length-RSYNCD_EXIT_LEN-1, RSYNCD_EXIT, RSYNCD_EXIT_LEN)) {
|
|
|
|
/* that's all, folks */
|
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "Final module list");
|
|
|
|
conversation_data->server_state = RSYNC_DATA;
|
|
|
|
} else { /* there must be more data */
|
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "Module list");
|
|
|
|
conversation_data->server_state = RSYNC_MODULE_LIST;
|
|
|
|
}
|
|
|
|
}
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
break;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
case RSYNC_DATA:
|
2013-10-18 21:11:11 +00:00
|
|
|
proto_tree_add_item(rsync_tree, &hfi_rsync_data, tvb, offset, -1, ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "Data");
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
conversation_data->server_state = RSYNC_DATA;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
break;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
default:
|
|
|
|
/* Unknown state */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else { /* me == CLIENT */
|
|
|
|
switch (rsync_frame_data_p->state) {
|
|
|
|
case RSYNC_INIT:
|
|
|
|
dissect_rsync_version_header(tvb, pinfo, rsync_tree, me);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
conversation_data->client_state = RSYNC_CLIENT_QUERY;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
break;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
case RSYNC_CLIENT_QUERY:
|
2013-10-18 21:11:11 +00:00
|
|
|
proto_tree_add_item(rsync_tree, &hfi_rsync_query_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "Client Query");
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
conversation_data->client_state = RSYNC_COMMAND;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
if (tvb_length(tvb) == RSYNC_MODULE_LIST_QUERY_LEN &&
|
|
|
|
0 == tvb_strneql(tvb, offset, RSYNC_MODULE_LIST_QUERY, RSYNC_MODULE_LIST_QUERY_LEN)) {
|
|
|
|
conversation_data->server_state = RSYNC_MODULE_LIST;
|
|
|
|
} else {
|
|
|
|
conversation_data->server_state = RSYNC_DATA;
|
|
|
|
}
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
break;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
case RSYNC_COMMAND:
|
|
|
|
/* then we are still sending commands */
|
2013-10-18 21:11:11 +00:00
|
|
|
proto_tree_add_item(rsync_tree, &hfi_rsync_command_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "Client Command");
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
conversation_data->client_state = RSYNC_COMMAND;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RSYNC_DATA:
|
|
|
|
/* then we are still sending commands */
|
2013-10-18 21:11:11 +00:00
|
|
|
proto_tree_add_item(rsync_tree, &hfi_rsync_data, tvb, offset, -1, ENC_NA);
|
2013-06-13 01:06:31 +00:00
|
|
|
|
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "Data");
|
|
|
|
|
|
|
|
conversation_data->client_state = RSYNC_DATA;
|
|
|
|
|
|
|
|
break;
|
2003-02-18 21:47:56 +00:00
|
|
|
|
2013-06-13 01:06:31 +00:00
|
|
|
default:
|
|
|
|
/* Unknown state */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return tvb_length(tvb);
|
2003-02-18 21:47:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Packet dissection routine called by tcp (& udp) when port 873 detected */
|
2013-06-13 01:06:31 +00:00
|
|
|
static int
|
|
|
|
dissect_rsync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
2003-02-18 21:47:56 +00:00
|
|
|
{
|
2013-06-13 01:06:31 +00:00
|
|
|
return dissect_rsync_encap(tvb, pinfo, tree, rsync_desegment);
|
2003-02-18 21:47:56 +00:00
|
|
|
}
|
|
|
|
|
2006-05-21 04:49:01 +00:00
|
|
|
/* Register protocol with Wireshark. */
|
2008-10-27 20:34:44 +00:00
|
|
|
|
|
|
|
void proto_reg_handoff_rsync(void);
|
|
|
|
|
2003-02-18 21:47:56 +00:00
|
|
|
void
|
|
|
|
proto_register_rsync(void)
|
|
|
|
{
|
2013-11-07 20:14:18 +00:00
|
|
|
#ifndef HAVE_HFI_SECTION_INIT
|
2013-10-18 21:11:11 +00:00
|
|
|
static header_field_info *hfi[] = {
|
|
|
|
&hfi_rsync_hdr_magic,
|
|
|
|
&hfi_rsync_hdr_version,
|
|
|
|
&hfi_rsync_query_string,
|
|
|
|
&hfi_rsync_module_list_string,
|
|
|
|
&hfi_rsync_motd_string,
|
|
|
|
&hfi_rsync_rsyncdok_string,
|
|
|
|
&hfi_rsync_command_string,
|
|
|
|
&hfi_rsync_data,
|
2003-02-18 21:47:56 +00:00
|
|
|
};
|
2013-11-07 20:14:18 +00:00
|
|
|
#endif
|
2003-02-18 21:47:56 +00:00
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_rsync,
|
|
|
|
};
|
|
|
|
|
|
|
|
module_t *rsync_module;
|
|
|
|
|
2013-10-18 21:11:11 +00:00
|
|
|
int proto_rsync;
|
|
|
|
|
2003-02-18 21:47:56 +00:00
|
|
|
proto_rsync = proto_register_protocol("RSYNC File Synchroniser",
|
2013-06-13 01:06:31 +00:00
|
|
|
"RSYNC", "rsync");
|
2013-10-18 21:11:11 +00:00
|
|
|
hfi_rsync = proto_registrar_get_nth(proto_rsync);
|
|
|
|
|
|
|
|
proto_register_fields(proto_rsync, hfi, array_length(hfi));
|
2003-02-18 21:47:56 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
2008-10-27 20:34:44 +00:00
|
|
|
rsync_module = prefs_register_protocol(proto_rsync, proto_reg_handoff_rsync);
|
2003-02-18 21:47:56 +00:00
|
|
|
prefs_register_uint_preference(rsync_module, "tcp_port",
|
|
|
|
"rsync TCP Port",
|
|
|
|
"Set the TCP port for RSYNC messages",
|
|
|
|
10,
|
|
|
|
&glb_rsync_tcp_port);
|
|
|
|
prefs_register_bool_preference(rsync_module, "desegment",
|
2013-06-13 01:06:31 +00:00
|
|
|
"Reassemble RSYNC messages spanning multiple TCP segments",
|
|
|
|
"Whether the RSYNC dissector should reassemble messages spanning multiple TCP segments."
|
|
|
|
" To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
|
|
|
|
&rsync_desegment);
|
2013-10-18 21:11:11 +00:00
|
|
|
|
|
|
|
rsync_handle = new_create_dissector_handle(dissect_rsync, proto_rsync);
|
2003-02-18 21:47:56 +00:00
|
|
|
}
|
|
|
|
void
|
|
|
|
proto_reg_handoff_rsync(void)
|
|
|
|
{
|
2008-10-27 20:34:44 +00:00
|
|
|
static gboolean initialized = FALSE;
|
|
|
|
static guint saved_rsync_tcp_port;
|
|
|
|
|
|
|
|
if (!initialized) {
|
|
|
|
initialized = TRUE;
|
|
|
|
} else {
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_delete_uint("tcp.port", saved_rsync_tcp_port, rsync_handle);
|
2008-10-27 20:34:44 +00:00
|
|
|
}
|
2010-05-13 18:28:34 +00:00
|
|
|
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("tcp.port", glb_rsync_tcp_port, rsync_handle);
|
2008-10-27 20:34:44 +00:00
|
|
|
saved_rsync_tcp_port = glb_rsync_tcp_port;
|
2003-02-18 21:47:56 +00:00
|
|
|
}
|
2013-06-13 01:06:31 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|