X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Frfc822%2Frfc822.h;h=19fccea8f35afbb3d36b0b68c420f7e30ef3572c;hp=2beae410cda27e80f4905aca63aa37cb776cd70d;hb=f71d6c64922b68fe3a785ec3a9faf093ef9299e1;hpb=de28abde1337e9255812ba720ffeef2c83a25dde diff --git a/ccan/rfc822/rfc822.h b/ccan/rfc822/rfc822.h index 2beae410..19fccea8 100644 --- a/ccan/rfc822/rfc822.h +++ b/ccan/rfc822/rfc822.h @@ -117,7 +117,7 @@ struct bytestring rfc822_body(struct rfc822_msg *msg); enum rfc822_header_errors { RFC822_HDR_NO_COLON = 1, - RFC822_HDR_BAD_NAME = 2, + RFC822_HDR_BAD_NAME_CHARS = 2, }; enum rfc822_header_errors rfc822_header_errors(struct rfc822_msg *msg, @@ -168,4 +168,23 @@ struct bytestring rfc822_header_raw_value(struct rfc822_msg *msg, struct bytestring rfc822_header_unfolded_value(struct rfc822_msg *msg, struct rfc822_header *hdr); +/** + * rfc822_header_is - determine if a header is of a given name + * @msg: message + * @hdr: a header handle + * @name: header name + * + * This returns true if the header field @hdr has name @name (case + * insensitive), otherwise false. + */ +bool rfc822_header_is(struct rfc822_msg *msg, struct rfc822_header *hdr, + const char *name); + +struct rfc822_header *rfc822_next_header_of_name(struct rfc822_msg *msg, + struct rfc822_header *hdr, + const char *name); + +#define rfc822_first_header_of_name(_msg, _name) \ + (rfc822_next_header_of_name((_msg), NULL, (_name))) + #endif /* CCAN_RFC822_H_ */