soa_6.c revision 6d12fdf96621801e80f3f4c2a8a569fe48766a20
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer * Copyright (C) 1998, 1999, 2000 Internet Software Consortium.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * Permission to use, copy, modify, and distribute this software for any
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * purpose with or without fee is hereby granted, provided that the above
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * copyright notice and this permission notice appear in all copies.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1d32b1df372d6be6bac6450739b9e5ea23819995Evan Hunt/* $Id: soa_6.c,v 1.39 2000/06/01 18:26:33 tale Exp $ */
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer/* Reviewed: Thu Mar 16 15:18:32 PST 2000 by explorer */
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer#define RRTYPE_SOA_ATTRIBUTES (DNS_RDATATYPEATTR_SINGLETON)
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt origin = (origin != NULL) ? origin : dns_rootname;
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt for (i = 0 ; i < 2 ; i++) {
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt RETERR(gettoken(lexer, &token, isc_tokentype_string,
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer buffer_fromregion(&buffer, &token.value.as_region);
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer RETERR(dns_name_fromtext(&name, &buffer, origin,
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer RETERR(gettoken(lexer, &token, isc_tokentype_number, ISC_FALSE));
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrence RETERR(uint32_tobuffer(token.value.as_ulong, target));
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer for (i = 0; i < 4; i++) {
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer RETERR(gettoken(lexer, &token, isc_tokentype_string,
fdebae839745f79a7550aeb49d15a930523ec483David Lawrence RETERR(dns_counter_fromtext(&token.value.as_textregion, &n));
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt isc_region_consume(&dregion, name_length(&mname));
9069215eac23e32f4ef1c8e44ad7ff2865cfcdacEvan Hunt isc_region_consume(&dregion, name_length(&rname));
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt for (i = 0; i < 5 ; i++) {
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt unsigned long num;
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt unsigned int numlen;
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt INSIST(numlen > 0 && numlen < sizeof "2147483647");
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt /* Print times in week/day/hour/minute/second form */
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt if (i >= 1) {
47e70d820ed07895a25e5b3520adf953114ac01eEvan Hunt dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14);
47e70d820ed07895a25e5b3520adf953114ac01eEvan Hunt RETERR(dns_name_fromwire(&mname, source, dctx, downcase, target));
b5b934a0bb46aded1552a17473652b5a7f4a3274Evan Hunt RETERR(dns_name_fromwire(&rname, source, dctx, downcase, target));
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt isc_region_consume(&sregion, name_length(&mname));
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Hunt isc_region_consume(&sregion, name_length(&rname));
6de9744cf9c64be2145f663e4051196a4eaa9d45Evan Huntstatic inline int
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews isc_region_consume(®ion1, name_length(&name1));
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews isc_region_consume(®ion2, name_length(&name2));
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews isc_region_consume(®ion1, name_length(&name1));
a69070d8fab55dbc63ba9f96c9d3e34f0ea9119aMark Andrews isc_region_consume(®ion2, name_length(&name2));
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer RETERR(isc_buffer_copyregion(target, ®ion));
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer RETERR(isc_buffer_copyregion(target, ®ion));
6b9c29ec578de7fda057bd3b893ccda176378b1bMichael Sawyer RETERR(uint32_tobuffer(soa->serial, target));
dc9c461b27df798ba7c3d9ba1446840c5f85553bMichael Sawyer RETERR(uint32_tobuffer(soa->refresh, target));
1b003261c2dd3e32778337c7a2788e4829066bd9Andreas Gustafsson RETERR(uint32_tobuffer(soa->retry, target));
1b003261c2dd3e32778337c7a2788e4829066bd9Andreas Gustafsson RETERR(uint32_tobuffer(soa->expire, target));
1b003261c2dd3e32778337c7a2788e4829066bd9Andreas Gustafsson return (uint32_tobuffer(soa->minimum, target));
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson isc_region_consume(®ion, name_length(&name));
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson RETERR(name_duporclone(&name, mctx, &soa->origin));
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson isc_region_consume(®ion, name_length(&name));
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson result = name_duporclone(&name, mctx, &soa->mname);
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson soa->serial = uint32_fromregion(®ion);
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson soa->refresh = uint32_fromregion(®ion);
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson soa->expire = uint32_fromregion(®ion);
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafsson soa->minimum = uint32_fromregion(®ion);
5337a9e53c7df1ef40d70528f2360c5e4cb9a7d1Andreas Gustafssonstatic inline void
8aee18709f238406719768b8a6b843a15c5075f8Mark Andrews#endif /* RDATA_GENERIC_SOA_6_C */