From: darkcoven Date: Mon, 7 Apr 2014 22:26:18 +0000 (+0200) Subject: Add invalid operation error code X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=593b630b518a2c72cf0b7844a5ad53b21e7d6392;p=ngadmin Add invalid operation error code --- diff --git a/cli/src/common.c b/cli/src/common.c index 74df335..f7a0acb 100644 --- a/cli/src/common.c +++ b/cli/src/common.c @@ -44,6 +44,10 @@ void printErrCode (int err) printf("bad reply from switch\n"); break; + case ERR_INVOP: + printf("invalid operation\n"); + break; + case ERR_UNKNOWN: printf("unknown error\n"); break; diff --git a/lib/include/ngadmin.h b/lib/include/ngadmin.h index a98f429..49dc761 100644 --- a/lib/include/ngadmin.h +++ b/lib/include/ngadmin.h @@ -50,7 +50,8 @@ enum { ERR_MEM = -8, /**< out of memory */ ERR_NOTIMPL = -9, /**< not implemented */ ERR_BADREPLY = -10, /**< bad reply */ - ERR_UNKNOWN = -11 /**< unknown error */ + ERR_INVOP = -11, /**< invalid operation */ + ERR_UNKNOWN = -12 /**< unknown error */ }; diff --git a/lib/src/network.c b/lib/src/network.c index 609d4b5..e62b5b8 100644 --- a/lib/src/network.c +++ b/lib/src/network.c @@ -149,6 +149,10 @@ static int checkErrorCode (const struct nsdp_cmd *nc) case 0: return ERR_OK; + case ERROR_READONLY: + case ERROR_WRITEONLY: + return ERR_INVOP; + case ERROR_DENIED: return (nc->attr_error == ATTR_PASSWORD) ? ERR_BADPASS : ERR_DENIED; diff --git a/raw/include/nsdp/protocol.h b/raw/include/nsdp/protocol.h index e346de5..5ab83c0 100644 --- a/raw/include/nsdp/protocol.h +++ b/raw/include/nsdp/protocol.h @@ -18,6 +18,7 @@ #define CODE_WRITE_REP 4 #define ERROR_READONLY 3 +#define ERROR_WRITEONLY 4 #define ERROR_INVALID_VALUE 5 #define ERROR_DENIED 7 diff --git a/wireshark/nsdp.lua b/wireshark/nsdp.lua index 53aea70..2518559 100644 --- a/wireshark/nsdp.lua +++ b/wireshark/nsdp.lua @@ -31,6 +31,8 @@ local op_codes = { local error_codes = { [0] = "OK", + [3] = "Read Only", + [4] = "Write Only", [5] = "Invalid Value", [7] = "Access Denied" }