aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-lpd.c
diff options
context:
space:
mode:
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2005-07-29 21:55:45 +0000
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2005-07-29 21:55:45 +0000
commit2dc24aea1d518fc50310747832e6ed1a0d989dc9 (patch)
tree5e7b6bf241ad5521c9f918f665d8698312fa266a /epan/dissectors/packet-lpd.c
parentb962607b8d4d24d3aa2f38dcb2143cde75f2e003 (diff)
Pick up some fixes and enhancements from
http://cvs.fedora.redhat.com/viewcvs/rpms/ethereal/FC-4/: In the LPD dissector, make lpd_client_code a value_string so that we don't segfault. Do the same for lpd_server_code, although it's not strictly necessary. Check to see if htmlview is installed, and use it as our HTML viewer. The Fedora RPM has other patches, but I'm not sure if they should be applied. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15143 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-lpd.c')
-rw-r--r--epan/dissectors/packet-lpd.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/epan/dissectors/packet-lpd.c b/epan/dissectors/packet-lpd.c
index 8585c1d8a8..abe592d06c 100644
--- a/epan/dissectors/packet-lpd.c
+++ b/epan/dissectors/packet-lpd.c
@@ -57,23 +57,24 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* This information comes from the LPRng HOWTO, which also describes
RFC 1179. http://www.astart.com/lprng/LPRng-HOWTO.html */
- static char *lpd_client_code[] = {
- "Unknown command",
- "LPC: start print / jobcmd: abort",
- "LPR: transfer a printer job / jobcmd: receive control file",
- "LPQ: print short form of queue status / jobcmd: receive data file",
- "LPQ: print long form of queue status",
- "LPRM: remove jobs",
- "LPRng lpc: do control operation",
- "LPRng lpr: transfer a block format print job",
- "LPRng lpc: secure command transfer",
- "LPRng lpq: verbose status information"
+ static value_string *lpd_client_code[] = {
+ { 1, "LPC: start print / jobcmd: abort" },
+ { 2, "LPR: transfer a printer job / jobcmd: receive control file" },
+ { 3, "LPQ: print short form of queue status / jobcmd: receive data file" },
+ { 4, "LPQ: print long form of queue status" },
+ { 5, "LPRM: remove jobs" },
+ { 6, "LPRng lpc: do control operation" },
+ { 7, "LPRng lpr: transfer a block format print job" },
+ { 8, "LPRng lpc: secure command transfer" },
+ { 9, "LPRng lpq: verbose status information" },
+ { 0, NULL }
};
- static char *lpd_server_code[] = {
- "Success: accepted, proceed",
- "Queue not accepting jobs",
- "Queue temporarily full, retry later",
- "Bad job format, do not retry"
+ static value_string *lpd_server_code[] = {
+ { 0, "Success: accepted, proceed" },
+ { 1, "Queue not accepting jobs" },
+ { 2, "Queue temporarily full, retry later" },
+ { 3, "Bad job format, do not retry" },
+ { 0, NULL }
};
if (check_col(pinfo->cinfo, COL_PROTOCOL))
@@ -95,7 +96,7 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (check_col(pinfo->cinfo, COL_INFO)) {
if (lpr_packet_type == request) {
- col_set_str(pinfo->cinfo, COL_INFO, lpd_client_code[code]);
+ col_set_str(pinfo->cinfo, COL_INFO, val_to_str(code, lpd_client_code, "Unknown client code: %u"));
}
else if (lpr_packet_type == response) {
col_set_str(pinfo->cinfo, COL_INFO, "LPD response");
@@ -122,7 +123,7 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (code <= 9 && printer_len != -1) {
proto_tree_add_text(lpd_tree, tvb, 0, 1,
- lpd_client_code[code]);
+ val_to_str(code, lpd_client_code, "Unknown client code: %u"));
proto_tree_add_text(lpd_tree, tvb, 1, printer_len,
"Printer/options: %s",
tvb_format_text(tvb, 1, printer_len));
@@ -134,7 +135,7 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
else if (lpr_packet_type == response) {
if (code <= 3) {
proto_tree_add_text(lpd_tree, tvb, 0, 1,
- "Response: %s", lpd_server_code[code]);
+ "Response: %s", val_to_str(code, lpd_server_code, "Unknown server code: %u"));
}
else {
call_dissector(data_handle,tvb, pinfo, lpd_tree);