diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-07-01 14:15:26 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-07-01 14:15:26 +0200 |
commit | d77c4160ecf7b1d33d49ba47e3236f5dcc14ecc8 (patch) | |
tree | e8c7f7de609003cf75eba19c50548df6b401046a /src/include | |
parent | f048de97822f29ec3dae5de57fab7a72a1fc4d8a (diff) |
implement logic to check protocol version compatibility (#5035)
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_exchange_service.h | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index 04fa51fff..487304c59 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -230,6 +230,58 @@ struct TALER_EXCHANGE_Keys }; +/** + * How compatible are the protocol version of the exchange and this + * client? The bits (1,2,4) can be used to test if the exchange's + * version is incompatible, older or newer respectively. + */ +enum TALER_EXCHANGE_VersionCompatibility +{ + + /** + * The exchange runs exactly the same protocol version. + */ + TALER_EXCHANGE_VC_MATCH = 0, + + /** + * The exchange is too old or too new to be compatible with this + * implementation (bit) + */ + TALER_EXCHANGE_VC_INCOMPATIBLE = 1, + + /** + * The exchange is older than this implementation (bit) + */ + TALER_EXCHANGE_VC_OLDER = 2, + + /** + * The exchange is too old to be compatible with + * this implementation. + */ + TALER_EXCHANGE_VC_INCOMPATIBLE_OUTDATED + = TALER_EXCHANGE_VC_INCOMPATIBLE + | TALER_EXCHANGE_VC_OLDER, + + /** + * The exchange is more recent than this implementation (bit). + */ + TALER_EXCHANGE_VC_NEWER = 4, + + /** + * The exchange is too recent for this implementation. + */ + TALER_EXCHANGE_VC_INCOMPATIBLE_NEWER + = TALER_EXCHANGE_VC_INCOMPATIBLE + | TALER_EXCHANGE_VC_NEWER, + + /** + * We could not even parse the version data. + */ + TALER_EXCHANGE_VC_PROTOCOL_ERROR = 8 + +}; + + /** * Function called with information about who is auditing * a particular exchange and what key the exchange is using. @@ -237,10 +289,12 @@ struct TALER_EXCHANGE_Keys * @param cls closure * @param keys information about the various keys used * by the exchange, NULL if /keys failed + * @param compat protocol compatibility information */ typedef void (*TALER_EXCHANGE_CertificationCallback) (void *cls, - const struct TALER_EXCHANGE_Keys *keys); + const struct TALER_EXCHANGE_Keys *keys, + enum TALER_EXCHANGE_VersionCompatibility compat); /** |