Changeset 988 for vendor/current/lib/addns/dns.h
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/lib/addns/dns.h
r740 r988 28 28 #include "../replace/replace.h" 29 29 #include "system/network.h" 30 #include "system/kerberos.h" 31 #include "system/gssapi.h" 30 32 31 33 /* make sure we have included the correct config.h */ … … 37 39 #endif /* NO_CONFIG_H */ 38 40 39 #include <stdio.h>40 #include <stdlib.h>41 41 #include <fcntl.h> 42 42 #include <time.h> 43 #include <string.h>44 #include <errno.h>45 43 #include <netdb.h> 46 #include <sys/types.h>47 #include <sys/socket.h>48 #include <netinet/in.h>49 #include <arpa/inet.h>50 #include <stdarg.h>51 52 #ifdef HAVE_UUID_UUID_H53 #include <uuid/uuid.h>54 #endif55 56 #ifdef HAVE_KRB5_H57 #include <krb5.h>58 #endif59 60 #ifdef HAVE_INTTYPES_H61 #include <inttypes.h>62 63 #ifndef int1664 #define int16 int16_t65 #endif66 67 #ifndef uint1668 #define uint16 uint16_t69 #endif70 71 #ifndef int3272 #define int32 int32_t73 #endif74 75 #ifndef uint3276 #define uint32 uint32_t77 #endif78 #endif79 80 #ifdef HAVE_KRB5_H81 #include <krb5.h>82 #endif83 84 #if HAVE_GSSAPI_GSSAPI_H85 #include <gssapi/gssapi.h>86 #elif HAVE_GSSAPI_GSSAPI_GENERIC_H87 #include <gssapi/gssapi_generic.h>88 #elif HAVE_GSSAPI_H89 #include <gssapi.h>90 #endif91 92 #if defined(HAVE_GSSAPI_H) || defined(HAVE_GSSAPI_GSSAPI_H) || defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)93 #define HAVE_GSSAPI_SUPPORT 194 #endif95 44 96 45 #include <talloc.h> 97 98 #if 099 100 Disable these now we have checked all code paths and ensured101 NULL returns on zero request. JRA.102 103 void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);104 void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const char *name);105 void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);106 void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);107 void *talloc_zeronull(const void *context, size_t size, const char *name);108 109 #define TALLOC(ctx, size) talloc_zeronull(ctx, size, __location__)110 #define TALLOC_P(ctx, type) (type *)talloc_zeronull(ctx, sizeof(type), #type)111 #define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array_zeronull(ctx, sizeof(type), count, #type)112 #define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup_zeronull(ctx, ptr, size, __location__)113 #define TALLOC_ZERO(ctx, size) _talloc_zero_zeronull(ctx, size, __location__)114 #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero_zeronull(ctx, sizeof(type), #type)115 #define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array_zeronull(ctx, sizeof(type), count, #type)116 #define TALLOC_SIZE(ctx, size) talloc_zeronull(ctx, size, __location__)117 #define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero_zeronull(ctx, size, __location__)118 119 #else120 121 #define TALLOC(ctx, size) talloc_named_const(ctx, size, __location__)122 #define TALLOC_P(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)123 #define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type)124 #define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup(ctx, ptr, size, __location__)125 #define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, size, __location__)126 #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)127 #define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type)128 #define TALLOC_SIZE(ctx, size) talloc_named_const(ctx, size, __location__)129 #define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero(ctx, size, __location__)130 131 #endif132 133 #define TALLOC_REALLOC(ctx, ptr, count) _talloc_realloc(ctx, ptr, count, __location__)134 #define TALLOC_REALLOC_ARRAY(ctx, ptr, type, count) (type *)_talloc_realloc_array(ctx, ptr, sizeof(type), count, #type)135 #define talloc_destroy(ctx) talloc_free(ctx)136 #ifndef TALLOC_FREE137 #define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx=NULL; } while(0)138 #endif139 140 /*******************************************************************141 Type definitions for int16, int32, uint16 and uint32. Needed142 for Samba coding style143 *******************************************************************/144 145 #ifndef uint8146 # define uint8 unsigned char147 #endif148 149 #if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H)150 # if (SIZEOF_SHORT == 4)151 # define int16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;152 # else /* SIZEOF_SHORT != 4 */153 # define int16 short154 # endif /* SIZEOF_SHORT != 4 */155 /* needed to work around compile issue on HP-UX 11.x */156 # define _INT16 1157 #endif158 159 /*160 * Note we duplicate the size tests in the unsigned161 * case as int16 may be a typedef from rpc/rpc.h162 */163 164 #if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)165 # if (SIZEOF_SHORT == 4)166 # define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;167 # else /* SIZEOF_SHORT != 4 */168 # define uint16 unsigned short169 # endif /* SIZEOF_SHORT != 4 */170 #endif171 172 #if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H)173 # if (SIZEOF_INT == 4)174 # define int32 int175 # elif (SIZEOF_LONG == 4)176 # define int32 long177 # elif (SIZEOF_SHORT == 4)178 # define int32 short179 # else180 /* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */181 # define int32 int182 # endif183 # ifndef _INT32184 /* needed to work around compile issue on HP-UX 11.x */185 # define _INT32 1186 # endif187 #endif188 189 /*190 * Note we duplicate the size tests in the unsigned191 * case as int32 may be a typedef from rpc/rpc.h192 */193 194 #if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H)195 # if (SIZEOF_INT == 4)196 # define uint32 unsigned int197 # elif (SIZEOF_LONG == 4)198 # define uint32 unsigned long199 # elif (SIZEOF_SHORT == 4)200 # define uint32 unsigned short201 # else202 /* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */203 # define uint32 unsigned204 # endif205 #endif206 207 /*208 * check for 8 byte long long209 */210 211 #if !defined(uint64)212 # if (SIZEOF_LONG == 8)213 # define uint64 unsigned long214 # elif (SIZEOF_LONG_LONG == 8)215 # define uint64 unsigned long long216 # endif /* don't lie. If we don't have it, then don't use it */217 #endif218 219 /* needed on Sun boxes */220 #ifndef INADDR_NONE221 #define INADDR_NONE 0xFFFFFFFF222 #endif223 46 224 47 #include "dnserr.h" … … 248 71 #define QTYPE_CNAME 5 249 72 #define QTYPE_SOA 6 73 #define QTYPE_AAAA 28 250 74 #define QTYPE_ANY 255 251 75 #define QTYPE_TKEY 249 … … 329 153 struct dns_question { 330 154 struct dns_domain_name *name; 331 uint16 q_type;332 uint16 q_class;155 uint16_t q_type; 156 uint16_t q_class; 333 157 }; 334 158 … … 341 165 struct dns_zone { 342 166 struct dns_domain_name *name; 343 uint16 z_type;344 uint16 z_class;167 uint16_t z_type; 168 uint16_t z_class; 345 169 }; 346 170 347 171 struct dns_rrec { 348 172 struct dns_domain_name *name; 349 uint16 type;350 uint16 r_class;351 uint32 ttl;352 uint16 data_length;353 uint8 *data;173 uint16_t type; 174 uint16_t r_class; 175 uint32_t ttl; 176 uint16_t data_length; 177 uint8_t *data; 354 178 }; 355 179 … … 358 182 time_t inception; 359 183 time_t expiration; 360 uint16 mode;361 uint16 error;362 uint16 key_length;363 uint8 *key;184 uint16_t mode; 185 uint16_t error; 186 uint16_t key_length; 187 uint8_t *key; 364 188 }; 365 189 366 190 struct dns_request { 367 uint16 id;368 uint16 flags;369 uint16 num_questions;370 uint16 num_answers;371 uint16 num_auths;372 uint16 num_additionals;191 uint16_t id; 192 uint16_t flags; 193 uint16_t num_questions; 194 uint16_t num_answers; 195 uint16_t num_auths; 196 uint16_t num_additionals; 373 197 struct dns_question **questions; 374 198 struct dns_rrec **answers; … … 384 208 385 209 struct dns_update_request { 386 uint16 id;387 uint16 flags;388 uint16 num_zones;389 uint16 num_preqs;390 uint16 num_updates;391 uint16 num_additionals;210 uint16_t id; 211 uint16_t flags; 212 uint16_t num_zones; 213 uint16_t num_preqs; 214 uint16_t num_updates; 215 uint16_t num_additionals; 392 216 struct dns_zone **zones; 393 217 struct dns_rrec **preqs; … … 397 221 398 222 struct dns_connection { 399 int32 hType;223 int32_t hType; 400 224 int s; 401 struct sockaddr RecvAddr;225 struct sockaddr_storage RecvAddr; 402 226 }; 403 227 404 228 struct dns_buffer { 405 uint8 *data;229 uint8_t *data; 406 230 size_t size; 407 231 size_t offset; … … 419 243 420 244 DNS_ERROR dns_create_query( TALLOC_CTX *mem_ctx, const char *name, 421 uint16 q_type, uint16q_class,245 uint16_t q_type, uint16_t q_class, 422 246 struct dns_request **preq ); 423 247 DNS_ERROR dns_create_update( TALLOC_CTX *mem_ctx, const char *name, … … 428 252 struct dns_update_request **preq); 429 253 DNS_ERROR dns_create_rrec(TALLOC_CTX *mem_ctx, const char *name, 430 uint16 type, uint16 r_class, uint32ttl,431 uint16 data_length, uint8*data,254 uint16_t type, uint16_t r_class, uint32_t ttl, 255 uint16_t data_length, uint8_t *data, 432 256 struct dns_rrec **prec); 433 257 DNS_ERROR dns_add_rrec(TALLOC_CTX *mem_ctx, struct dns_rrec *rec, 434 uint16 *num_records, struct dns_rrec ***records);258 uint16_t *num_records, struct dns_rrec ***records); 435 259 DNS_ERROR dns_create_tkey_record(TALLOC_CTX *mem_ctx, const char *keyname, 436 260 const char *algorithm_name, time_t inception, 437 time_t expiration, uint16 mode, uint16error,438 uint16 key_length, const uint8*key,261 time_t expiration, uint16_t mode, uint16_t error, 262 uint16_t key_length, const uint8_t *key, 439 263 struct dns_rrec **prec); 440 264 DNS_ERROR dns_create_name_in_use_record(TALLOC_CTX *mem_ctx, … … 443 267 struct dns_rrec **prec); 444 268 DNS_ERROR dns_create_delete_record(TALLOC_CTX *mem_ctx, const char *name, 445 uint16 type, uint16r_class,269 uint16_t type, uint16_t r_class, 446 270 struct dns_rrec **prec); 447 271 DNS_ERROR dns_create_name_not_in_use_record(TALLOC_CTX *mem_ctx, 448 const char *name, uint32 type,272 const char *name, uint32_t type, 449 273 struct dns_rrec **prec); 450 274 DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host, 451 uint32 ttl, const struct sockaddr_storage *pss,275 uint32_t ttl, const struct sockaddr_storage *pss, 452 276 struct dns_rrec **prec); 277 DNS_ERROR dns_create_aaaa_record(TALLOC_CTX *mem_ctx, const char *host, 278 uint32_t ttl, const struct sockaddr_storage *pss, 279 struct dns_rrec **prec); 453 280 DNS_ERROR dns_unmarshall_tkey_record(TALLOC_CTX *mem_ctx, struct dns_rrec *rec, 454 281 struct dns_tkey_record **ptkey); 455 282 DNS_ERROR dns_create_tsig_record(TALLOC_CTX *mem_ctx, const char *keyname, 456 283 const char *algorithm_name, 457 time_t time_signed, uint16 fudge,458 uint16 mac_length, const uint8*mac,459 uint16 original_id, uint16error,284 time_t time_signed, uint16_t fudge, 285 uint16_t mac_length, const uint8_t *mac, 286 uint16_t original_id, uint16_t error, 460 287 struct dns_rrec **prec); 461 288 DNS_ERROR dns_add_rrec(TALLOC_CTX *mem_ctx, struct dns_rrec *rec, 462 uint16 *num_records, struct dns_rrec ***records);289 uint16_t *num_records, struct dns_rrec ***records); 463 290 DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx, 464 291 const char *domainname, … … 470 297 /* from dnssock.c */ 471 298 472 DNS_ERROR dns_open_connection( const char *nameserver, int32 dwType,299 DNS_ERROR dns_open_connection( const char *nameserver, int32_t dwType, 473 300 TALLOC_CTX *mem_ctx, 474 301 struct dns_connection **conn ); … … 487 314 488 315 struct dns_buffer *dns_create_buffer(TALLOC_CTX *mem_ctx); 489 void dns_marshall_buffer(struct dns_buffer *buf, const uint8 *data,316 void dns_marshall_buffer(struct dns_buffer *buf, const uint8_t *data, 490 317 size_t len); 491 void dns_marshall_uint16(struct dns_buffer *buf, uint16 val);492 void dns_marshall_uint32(struct dns_buffer *buf, uint32 val);493 void dns_unmarshall_buffer(struct dns_buffer *buf, uint8 *data,318 void dns_marshall_uint16(struct dns_buffer *buf, uint16_t val); 319 void dns_marshall_uint32(struct dns_buffer *buf, uint32_t val); 320 void dns_unmarshall_buffer(struct dns_buffer *buf, uint8_t *data, 494 321 size_t len); 495 void dns_unmarshall_uint16(struct dns_buffer *buf, uint16 *val);496 void dns_unmarshall_uint32(struct dns_buffer *buf, uint32 *val);322 void dns_unmarshall_uint16(struct dns_buffer *buf, uint16_t *val); 323 void dns_unmarshall_uint32(struct dns_buffer *buf, uint32_t *val); 497 324 void dns_unmarshall_domain_name(TALLOC_CTX *mem_ctx, 498 325 struct dns_buffer *buf, … … 517 344 struct dns_request *dns_update2request(struct dns_update_request *update); 518 345 struct dns_update_request *dns_request2update(struct dns_request *request); 519 uint16 dns_response_code(uint16flags);346 uint16_t dns_response_code(uint16_t flags); 520 347 const char *dns_errstr(DNS_ERROR err); 521 348 522 349 /* from dnsgss.c */ 523 350 524 #ifdef HAVE_GSSAPI _SUPPORT351 #ifdef HAVE_GSSAPI 525 352 526 353 void display_status( const char *msg, OM_uint32 maj_stat, OM_uint32 min_stat ); … … 534 361 const char *keyname, 535 362 const char *algorithmname, 536 time_t time_signed, uint16 fudge);537 538 #endif /* HAVE_GSSAPI _SUPPORT*/363 time_t time_signed, uint16_t fudge); 364 365 #endif /* HAVE_GSSAPI */ 539 366 540 367 #endif /* _DNS_H */
Note:
See TracChangeset
for help on using the changeset viewer.