diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-08-12 14:18:25 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-08-12 16:44:40 -0700 |
commit | 3199c6fb39f02b36a07ef65bf4b07d6ec340944d (patch) | |
tree | 59613bdf195e6f0490f672badd881372f2de9ac9 /decode_wcp.c | |
parent | fccbbd6f3bdc090d2da9b32fdff2fd13679e2b78 (diff) | |
download | xscope-3199c6fb39f02b36a07ef65bf4b07d6ec340944d.tar.gz |
Convert extension decoding to function pointer tables
Each extension now registers it's own request, reply, event & error decoding
functions as needed in the central table, instead of a cascading block of
if/else statements to modify for each new extension added.
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Diffstat (limited to 'decode_wcp.c')
-rw-r--r-- | decode_wcp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/decode_wcp.c b/decode_wcp.c index fdb7664..1e37a95 100644 --- a/decode_wcp.c +++ b/decode_wcp.c @@ -32,9 +32,9 @@ #include "wcpscope.h" #include "extensions.h" -unsigned char WCPRequest, WCPError; +static unsigned char WCPRequest, WCPError; -void +static void wcp_decode_req ( FD fd, const unsigned char *buf) @@ -71,7 +71,7 @@ wcp_decode_req ( } } -void +static void wcp_decode_reply ( FD fd, const unsigned char *buf, @@ -89,7 +89,7 @@ wcp_decode_reply ( } } -void +static void wcp_decode_error ( FD fd, const unsigned char *buf) @@ -129,4 +129,6 @@ InitializeWCP ( p = DefineType(WCPREPLY, ENUMERATED, "WCPREPLY", (PrintProcType) PrintENUMERATED); DefineEValue (p, 0L, "QueryVersion"); + InitializeExtensionDecoder(WCPRequest, wcp_decode_req, wcp_decode_reply); + InitializeExtensionErrorDecoder(WCPError, wcp_decode_error); } |