mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 07:09:59 -04:00
227. [cleanup] The enumerated identifiers dns_rdataclass_*,
dns_rcode_*, dns_opcode_*, and dns_trust_* are
also now cast to their appropriate types.
This commit is contained in:
parent
3098bf3ce3
commit
1c70c5ee90
2 changed files with 66 additions and 22 deletions
|
|
@ -15,7 +15,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: gen.c,v 1.48 2000/06/01 21:42:38 tale Exp $ */
|
||||
/* $Id: gen.c,v 1.49 2000/06/02 01:07:03 tale Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ struct ttnam {
|
|||
char *
|
||||
upper(char *);
|
||||
char *
|
||||
funname(char *, char *);
|
||||
funname(const char *, char *);
|
||||
void
|
||||
doswitch(const char *, const char *, const char *, const char *,
|
||||
const char *, const char *);
|
||||
|
|
@ -172,7 +172,7 @@ upper(char *s) {
|
|||
}
|
||||
|
||||
char *
|
||||
funname(char *s, char *buf) {
|
||||
funname(const char *s, char *buf) {
|
||||
char *b = buf;
|
||||
char c;
|
||||
|
||||
|
|
@ -759,22 +759,42 @@ main(int argc, char **argv) {
|
|||
fprintf(stdout, "\n#endif /* DNS_ENUMTYPE_H */\n");
|
||||
|
||||
} else if (class_enum) {
|
||||
fprintf(stdout, "#ifndef DNS_ENUMCLASS_H\n");
|
||||
fprintf(stdout, "#define DNS_ENUMCLASS_H 1\n");
|
||||
|
||||
fprintf(stdout, "#define DNS_CLASSENUM%s\n",
|
||||
classes != NULL ? " \\" : "");
|
||||
char *s;
|
||||
int classnum;
|
||||
|
||||
printf("#ifndef DNS_ENUMCLASS_H\n");
|
||||
printf("#define DNS_ENUMCLASS_H 1\n\n");
|
||||
|
||||
printf("enum {\n");
|
||||
|
||||
printf("\tdns_rdataclass_reserved0 = 0,\n");
|
||||
printf("#define dns_rdataclass_reserved0 \\\n\t\t\t\t"
|
||||
"((dns_rdataclass_t)dns_rdataclass_reserved0)\n");
|
||||
|
||||
#define PRINTCLASS(name, num) \
|
||||
do { \
|
||||
s = funname(name, buf1); \
|
||||
classnum = num; \
|
||||
printf("\tdns_rdataclass_%s = %d,\n", s, classnum); \
|
||||
printf("#define dns_rdataclass_%s\t" \
|
||||
"((dns_rdataclass_t)dns_rdataclass_%s)\n", s, s); \
|
||||
} while (0)
|
||||
|
||||
printf("\t dns_rdataclass_reserved0 = 0, \\\n");
|
||||
for (cc = classes; cc != NULL; cc = cc->next) {
|
||||
if (cc->rdclass == 4)
|
||||
printf("\t dns_rdataclass_chaos = 3, \\\n");
|
||||
fprintf(stdout, "\t dns_rdataclass_%s = %d,%s\n",
|
||||
funname(cc->classname, buf1),
|
||||
cc->rdclass,
|
||||
cc->next != NULL ? " \\" : "");
|
||||
if (cc->rdclass == 4) {
|
||||
PRINTCLASS("ch", 3);
|
||||
PRINTCLASS("chaos", 3);
|
||||
|
||||
} else if (cc->rdclass == 255) {
|
||||
PRINTCLASS("none", 254);
|
||||
}
|
||||
PRINTCLASS(cc->classname, cc->rdclass);
|
||||
}
|
||||
fprintf(stdout, "#endif /* DNS_ENUMCLASS_H */\n");
|
||||
|
||||
#undef PRINTCLASS
|
||||
|
||||
printf("};\n\n");
|
||||
printf("#endif /* DNS_ENUMCLASS_H */\n");
|
||||
} else if (structs) {
|
||||
if (prefix != NULL) {
|
||||
if ((fd = fopen(prefix,"r")) != NULL) {
|
||||
|
|
|
|||
|
|
@ -129,14 +129,11 @@ typedef enum {
|
|||
dns_one_answer, dns_many_answers
|
||||
} dns_transfer_format_t;
|
||||
|
||||
/*
|
||||
* These are generated by gen.c for dns_rdatatype_t and dns_rdataclass_t.
|
||||
*/
|
||||
#include <dns/enumtype.h>
|
||||
|
||||
#include <dns/enumclass.h>
|
||||
enum {
|
||||
DNS_CLASSENUM
|
||||
dns_rdataclass_ch = 3,
|
||||
dns_rdataclass_none = 254 /* RFC2136 */
|
||||
};
|
||||
|
||||
/*
|
||||
* rcodes.
|
||||
|
|
@ -146,20 +143,32 @@ enum {
|
|||
* Standard rcodes.
|
||||
*/
|
||||
dns_rcode_noerror = 0,
|
||||
#define dns_rcode_noerror ((dns_rcode_t)dns_rcode_noerror)
|
||||
dns_rcode_formerr = 1,
|
||||
#define dns_rcode_formerr ((dns_rcode_t)dns_rcode_formerr)
|
||||
dns_rcode_servfail = 2,
|
||||
#define dns_rcode_servfail ((dns_rcode_t)dns_rcode_servfail)
|
||||
dns_rcode_nxdomain = 3,
|
||||
#define dns_rcode_nxdomain ((dns_rcode_t)dns_rcode_nxdomain)
|
||||
dns_rcode_notimp = 4,
|
||||
#define dns_rcode_notimp ((dns_rcode_t)dns_rcode_notimp)
|
||||
dns_rcode_refused = 5,
|
||||
#define dns_rcode_refused ((dns_rcode_t)dns_rcode_refused)
|
||||
dns_rcode_yxdomain = 6,
|
||||
#define dns_rcode_yxdomain ((dns_rcode_t)dns_rcode_yxdomain)
|
||||
dns_rcode_yxrrset = 7,
|
||||
#define dns_rcode_yxrrset ((dns_rcode_t)dns_rcode_yxrrset)
|
||||
dns_rcode_nxrrset = 8,
|
||||
#define dns_rcode_nxrrset ((dns_rcode_t)dns_rcode_nxrrset)
|
||||
dns_rcode_notauth = 9,
|
||||
#define dns_rcode_notauth ((dns_rcode_t)dns_rcode_notauth)
|
||||
dns_rcode_notzone = 10,
|
||||
#define dns_rcode_notzone ((dns_rcode_t)dns_rcode_notzone)
|
||||
/*
|
||||
* Extended rcodes.
|
||||
*/
|
||||
dns_rcode_badvers = 16
|
||||
#define dns_rcode_badvers ((dns_rcode_t)dns_rcode_badvers)
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -179,10 +188,15 @@ enum {
|
|||
*/
|
||||
enum {
|
||||
dns_opcode_query = 0,
|
||||
#define dns_opcode_query ((dns_opcode_t)dns_opcode_query)
|
||||
dns_opcode_iquery = 1,
|
||||
#define dns_opcode_iquery ((dns_opcode_t)dns_opcode_iquery)
|
||||
dns_opcode_status = 2,
|
||||
#define dns_opcode_status ((dns_opcode_t)dns_opcode_status)
|
||||
dns_opcode_notify = 4,
|
||||
#define dns_opcode_notify ((dns_opcode_t)dns_opcode_notify)
|
||||
dns_opcode_update = 5 /* dynamic update */
|
||||
#define dns_opcode_update ((dns_opcode_t)dns_opcode_update)
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -190,15 +204,25 @@ enum {
|
|||
*/
|
||||
enum {
|
||||
dns_trust_none = 0,
|
||||
#define dns_trust_none ((dns_trust_t)dns_trust_none)
|
||||
dns_trust_pending = 1,
|
||||
#define dns_trust_pending ((dns_trust_t)dns_trust_pending)
|
||||
dns_trust_additional = 2,
|
||||
#define dns_trust_additional ((dns_trust_t)dns_trust_additional)
|
||||
dns_trust_glue = 3,
|
||||
#define dns_trust_glue ((dns_trust_t)dns_trust_glue)
|
||||
dns_trust_answer = 4,
|
||||
#define dns_trust_answer ((dns_trust_t)dns_trust_answer)
|
||||
dns_trust_authauthority = 5,
|
||||
#define dns_trust_authauthority ((dns_trust_t)dns_trust_authauthority)
|
||||
dns_trust_authanswer = 6,
|
||||
#define dns_trust_authanswer ((dns_trust_t)dns_trust_authanswer)
|
||||
dns_trust_secure = 7,
|
||||
#define dns_trust_secure ((dns_trust_t)dns_trust_secure)
|
||||
dns_trust_authsecure = 8,
|
||||
#define dns_trust_authsecure ((dns_trust_t)dns_trust_authsecure)
|
||||
dns_trust_ultimate = 9
|
||||
#define dns_trust_ultimate ((dns_trust_t)dns_trust_ultimate)
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue