From: John Kohl Date: Tue, 17 Apr 1990 16:57:17 +0000 (+0000) Subject: add ASN.1 application data smarts for checking packet types X-Git-Tag: krb5-1.0-alpha2~915 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a5fe7c12e0b83d732e25fadabebfbde3e004d5be;p=krb5.git add ASN.1 application data smarts for checking packet types git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@480 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/krb5/asn.1/encode.h b/src/include/krb5/asn.1/encode.h index ebd2f1ba0..0b2602e86 100644 --- a/src/include/krb5/asn.1/encode.h +++ b/src/include/krb5/asn.1/encode.h @@ -211,5 +211,28 @@ krb5_error_code decode_generic (translator_func) KRB5_KRB__ERROR2krb5_error, \ (free_func) free_KRB5_KRB__ERROR) +/* ASN.1 encoding knowledge; KEEP IN SYNC WITH ASN.1 defs! */ +/* here we use some knowledge of ASN.1 encodings */ +/* + AS_REQ is APPLICATION 0. + KDC_REP is APPLICATION 1. + KRB_ERROR is APPLICATION 2. + AP_REQ is APPLICATION 3. + AP_REP is APPLICATION 4. + TGS_REQ is APPLICATION 5. + KRB_SAFE is APPLICATION 6. + KRB_PRIV is APPLICATION 7. + */ +/* allow either constructed or primitive encoding, so check for bit 6 + set or reset */ +#define krb5_is_as_req(data) ((data)[0] == 0x60 || (data)[0] == 0x20) +#define krb5_is_kdc_rep(data) ((data)[0] == 0x61 || (data)[0] == 0x21) +#define krb5_is_krb_error(data) ((data)[0] == 0x62 || (data)[0] == 0x22) +#define krb5_is_ap_req(data) ((data)[0] == 0x63 || (data)[0] == 0x23) +#define krb5_is_ap_rep(data) ((data)[0] == 0x64 || (data)[0] == 0x24) +#define krb5_is_tgs_req(data) ((data)[0] == 0x65 || (data)[0] == 0x25) +#define krb5_is_krb_safe(data) ((data)[0] == 0x66 || (data)[0] == 0x26) +#define krb5_is_krb_priv(data) ((data)[0] == 0x67 || (data)[0] == 0x27) + #endif /* KRB5_ENCODE_DEFS__ */