From 1f3e259eeebfc26313aca3998e9951b4f2fff31e Mon Sep 17 00:00:00 2001 From: Radim Kolar <> Date: Mon, 21 Sep 2009 18:17:08 +0200 Subject: [PATCH] add support for error codes for CC_ERR --- ChangeLog | 11 +++++++++++ doc/PROTOCOL | 20 ++++++++++++++++++-- server/server.c | 1 + 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9b3c28..6389bb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,6 +37,17 @@ Version NEXT SCons now check if CC compiler works. We need SCons 1.1 or greater for building FSP now. Large file support on Linux is now correctly detected. + Error codes added to CC_ERR command in PROTOCOL. It was long wished + feature from ISV. Now there is standard way how to pass error codes + from server to client. No such codes are defined yet, but you can + use custom error codes in range 0xF000 - 0xFFFF. because no such + codes are defined fspd do not sends them in error message, but it + now correctly zeroes bb_pos field in CC_ERR reply to indicate + that extended error code status is not attached to message. Old + fspd versions left this field untouched - it will contain request + bb_pos in most, but not all cases. Because we indicate size of + extra data to be received, this extended error handling is + compatible with "plain FSP over serial" standard. Version 2.8.1b25 - 10 Sep 2009 GNU autotools build system was entirely replaced by SCons diff --git a/doc/PROTOCOL b/doc/PROTOCOL index 31db839..26a0e5f 100644 --- a/doc/PROTOCOL +++ b/doc/PROTOCOL @@ -252,9 +252,25 @@ CC_VERSION is recommended. xtra data: not used reply - file position: not used + file position: size of extra data data: ASCIIZ Error string - xtra data: not used + xtra data: not required + word - error status code + + Error status codes are not currently standardised. If you + wish to participate in standardization process join FSP-devel + mailing list. For use in your own software use vendor-specific + error codes which have reserved range 0xF000 - 0xFFFF. + + Compatibility + + Support for sizing of extra data in reply was added + in fsp 2.8.1b26. Previous versions left this field + unchanged. In old versions it will most likely contain + file position used by requests but not always. In some + code paths in fspd it will be just uninitialized memory. + Its recommended to check if file position in reply is 2 + otherwise it should be processed as containing zero. CC_GET_DIR 0x41 - get a directory listing diff --git a/server/server.c b/server/server.c index 041e647..ab9eeac 100644 --- a/server/server.c +++ b/server/server.c @@ -146,6 +146,7 @@ static void send_error (struct sockaddr_in * from, UBUF * ub, const char * msg) sz=strlen(msg)+1; memcpy(ub->buf,msg,sz); ub->cmd = CC_ERR; + BB_WRITE4(ub->bb_pos,0); server_reply(from,ub,sz,0); }