<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>ldns documentation</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <div class="logo"> <img src="LogoInGradientBar2-y100.png"/> </div> <!-- Generated by Doxygen 1.7.4 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_20c14e699119abd60cb7b016b4381923.html">examples</a> </li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">ldns-read-zone.c</div> </div> </div> <div class="contents"> <a href="ldns-read-zone_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> * read a zone file from disk and prints it, one RR per line</span> <a name="l00003"></a>00003 <span class="comment"> *</span> <a name="l00004"></a>00004 <span class="comment"> * (c) NLnetLabs 2005-2008</span> <a name="l00005"></a>00005 <span class="comment"> *</span> <a name="l00006"></a>00006 <span class="comment"> * See the file LICENSE for the license</span> <a name="l00007"></a>00007 <span class="comment"> */</span> <a name="l00008"></a>00008 <a name="l00009"></a>00009 <span class="preprocessor">#include "config.h"</span> <a name="l00010"></a>00010 <span class="preprocessor">#include <unistd.h></span> <a name="l00011"></a>00011 <span class="preprocessor">#include <stdlib.h></span> <a name="l00012"></a>00012 <a name="l00013"></a>00013 <span class="preprocessor">#include <<a class="code" href="ldns_8h.html" title="Including this file will include all ldns files, and define some lookup tables.">ldns/ldns.h</a>></span> <a name="l00014"></a>00014 <span class="preprocessor">#include <<a class="code" href="host2str_8h.html" title="host2str.h - txt presentation of RRs">ldns/host2str.h</a>></span> <a name="l00015"></a>00015 <a name="l00016"></a>00016 <span class="preprocessor">#include <errno.h></span> <a name="l00017"></a>00017 <a name="l00018"></a>00018 <span class="keywordtype">int</span> <a name="l00019"></a><a class="code" href="ldns-read-zone_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">00019</a> <a class="code" href="linktest_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv) <a name="l00020"></a>00020 { <a name="l00021"></a>00021 <span class="keywordtype">char</span> *filename; <a name="l00022"></a>00022 FILE *fp; <a name="l00023"></a>00023 <a class="code" href="structldns__struct__zone.html" title="DNS Zone.">ldns_zone</a> *z; <a name="l00024"></a>00024 <span class="keywordtype">int</span> line_nr = 0; <a name="l00025"></a>00025 <span class="keywordtype">int</span> c; <a name="l00026"></a>00026 <span class="keywordtype">bool</span> canonicalize = <span class="keyword">false</span>; <a name="l00027"></a>00027 <span class="keywordtype">bool</span> sort = <span class="keyword">false</span>; <a name="l00028"></a>00028 <span class="keywordtype">bool</span> strip = <span class="keyword">false</span>; <a name="l00029"></a>00029 <span class="keywordtype">bool</span> only_dnssec = <span class="keyword">false</span>; <a name="l00030"></a>00030 <span class="keywordtype">bool</span> print_soa = <span class="keyword">true</span>; <a name="l00031"></a>00031 <a class="code" href="error_8h.html#aaa6d98f86f535cf87b83b89e91f488f9">ldns_status</a> s; <a name="l00032"></a>00032 <span class="keywordtype">size_t</span> i; <a name="l00033"></a>00033 <a class="code" href="structldns__struct__rr__list.html" title="List or Set of Resource Records.">ldns_rr_list</a> *stripped_list; <a name="l00034"></a>00034 <a class="code" href="structldns__struct__rr.html" title="Resource Record.">ldns_rr</a> *cur_rr; <a name="l00035"></a>00035 <a class="code" href="rr_8h.html#a5b71c1de711a178f6fbda5d684cdfed5">ldns_rr_type</a> cur_rr_type; <a name="l00036"></a>00036 <span class="keyword">const</span> <a class="code" href="structldns__struct__output__format.html" title="Output format specifier.">ldns_output_format</a> *fmt = NULL; <a name="l00037"></a>00037 <a class="code" href="rr__functions_8h.html#adef62d383c5b0e3965ad5d7fe5177507" title="The type of function to be passed to ldns_rr_soa_increment_func, ldns_rr_soa_increment_func_data or l...">ldns_soa_serial_increment_func_t</a> soa_serial_increment_func = NULL; <a name="l00038"></a>00038 <span class="keywordtype">int</span> soa_serial_increment_func_data = 0; <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="keywordflow">while</span> ((c = getopt(argc, argv, <span class="stringliteral">"bcdhnsvzS:"</span>)) != -1) { <a name="l00041"></a>00041 <span class="keywordflow">switch</span>(c) { <a name="l00042"></a>00042 <span class="keywordflow">case</span> <span class="charliteral">'b'</span>: <a name="l00043"></a>00043 fmt = <a class="code" href="host2str_8c.html#aeb52aaf30c03a2b9942ae3017f71358e" title="Standard output format record that shows all DNSKEY related information in the comment text...">ldns_output_format_bubblebabble</a>; <a name="l00044"></a>00044 <span class="keywordflow">case</span> <span class="charliteral">'c'</span>: <a name="l00045"></a>00045 canonicalize = <span class="keyword">true</span>; <a name="l00046"></a>00046 <span class="keywordflow">break</span>; <a name="l00047"></a>00047 <span class="keywordflow">case</span> <span class="charliteral">'d'</span>: <a name="l00048"></a>00048 only_dnssec = <span class="keyword">true</span>; <a name="l00049"></a>00049 <span class="keywordflow">if</span> (strip) { <a name="l00050"></a>00050 fprintf(stderr, <span class="stringliteral">"Warning: stripping both DNSSEC and non-DNSSEC records. Output will be sparse.\n"</span>); <a name="l00051"></a>00051 } <a name="l00052"></a>00052 <span class="keywordflow">break</span>; <a name="l00053"></a>00053 <span class="keywordflow">case</span> <span class="charliteral">'h'</span>: <a name="l00054"></a>00054 printf(<span class="stringliteral">"Usage: %s [-c] [-v] [-z] <zonefile>\n"</span>, argv[0]); <a name="l00055"></a>00055 printf(<span class="stringliteral">"\tReads the zonefile and prints it.\n"</span>); <a name="l00056"></a>00056 printf(<span class="stringliteral">"\tThe RR count of the zone is printed to stderr.\n"</span>); <a name="l00057"></a>00057 printf(<span class="stringliteral">"\t-b include bubblebabble of DS's.\n"</span>); <a name="l00058"></a>00058 printf(<span class="stringliteral">"\t-c canonicalize all rrs in the zone.\n"</span>); <a name="l00059"></a>00059 printf(<span class="stringliteral">"\t-d only show DNSSEC data from the zone\n"</span>); <a name="l00060"></a>00060 printf(<span class="stringliteral">"\t-h show this text\n"</span>); <a name="l00061"></a>00061 printf(<span class="stringliteral">"\t-n do not print the SOA record\n"</span>); <a name="l00062"></a>00062 printf(<span class="stringliteral">"\t-s strip DNSSEC data from the zone\n"</span>); <a name="l00063"></a>00063 printf(<span class="stringliteral">"\t-S [[+|-]<number> | YYYYMMDDxx | "</span> <a name="l00064"></a>00064 <span class="stringliteral">" unixtime ]\n"</span> <a name="l00065"></a>00065 <span class="stringliteral">"\t\tSet serial number to <number> or,"</span> <a name="l00066"></a>00066 <span class="stringliteral">" when preceded by a sign,\n"</span> <a name="l00067"></a>00067 <span class="stringliteral">"\t\toffset the existing number with "</span> <a name="l00068"></a>00068 <span class="stringliteral">"<number>. With YYYYMMDDxx\n"</span> <a name="l00069"></a>00069 <span class="stringliteral">"\t\tthe serial is formatted as a datecounter"</span> <a name="l00070"></a>00070 <span class="stringliteral">", and with unixtime as the\n"</span> <a name="l00071"></a>00071 <span class="stringliteral">"\t\tnumber of seconds since 1-1-1970."</span> <a name="l00072"></a>00072 <span class="stringliteral">" However, on serial number"</span> <a name="l00073"></a>00073 <span class="stringliteral">"\n\t\tdecrease, +1 is used in stead"</span> <a name="l00074"></a>00074 <span class="stringliteral">". (implies -s)\n"</span>); <a name="l00075"></a>00075 printf(<span class="stringliteral">"\t-v shows the version and exits\n"</span>); <a name="l00076"></a>00076 printf(<span class="stringliteral">"\t-z sort the zone (implies -c).\n"</span>); <a name="l00077"></a>00077 printf(<span class="stringliteral">"\nif no file is given standard input is read\n"</span>); <a name="l00078"></a>00078 exit(EXIT_SUCCESS); <a name="l00079"></a>00079 <span class="keywordflow">break</span>; <a name="l00080"></a>00080 <span class="keywordflow">case</span> <span class="charliteral">'n'</span>: <a name="l00081"></a>00081 print_soa = <span class="keyword">false</span>; <a name="l00082"></a>00082 <span class="keywordflow">break</span>; <a name="l00083"></a>00083 <span class="keywordflow">case</span> <span class="charliteral">'s'</span>: <a name="l00084"></a>00084 strip = <span class="keyword">true</span>; <a name="l00085"></a>00085 <span class="keywordflow">if</span> (only_dnssec) { <a name="l00086"></a>00086 fprintf(stderr, <span class="stringliteral">"Warning: stripping both DNSSEC and non-DNSSEC records. Output will be sparse.\n"</span>); <a name="l00087"></a>00087 } <a name="l00088"></a>00088 <span class="keywordflow">break</span>; <a name="l00089"></a>00089 <span class="keywordflow">case</span> <span class="charliteral">'v'</span>: <a name="l00090"></a>00090 printf(<span class="stringliteral">"read zone version %s (ldns version %s)\n"</span>, <a class="code" href="util_8h.html#a991dc2d5a646a3f66f91ba6b62c93615">LDNS_VERSION</a>, <a class="code" href="util_8c.html#acfa02e74a31c812d2e4ecf40915b418f" title="Show the internal library version.">ldns_version</a>()); <a name="l00091"></a>00091 exit(EXIT_SUCCESS); <a name="l00092"></a>00092 <span class="keywordflow">break</span>; <a name="l00093"></a>00093 <span class="keywordflow">case</span> <span class="charliteral">'z'</span>: <a name="l00094"></a>00094 canonicalize = <span class="keyword">true</span>; <a name="l00095"></a>00095 sort = <span class="keyword">true</span>; <a name="l00096"></a>00096 <span class="keywordflow">break</span>; <a name="l00097"></a>00097 <span class="keywordflow">case</span> <span class="charliteral">'S'</span>: <a name="l00098"></a>00098 strip = <span class="keyword">true</span>; <a name="l00099"></a>00099 <span class="keywordflow">if</span> (*optarg == <span class="charliteral">'+'</span> || *optarg == <span class="charliteral">'-'</span>) { <a name="l00100"></a>00100 soa_serial_increment_func_data = <a name="l00101"></a>00101 atoi(optarg); <a name="l00102"></a>00102 soa_serial_increment_func = <a name="l00103"></a>00103 <a class="code" href="rr__functions_8c.html#ae6900c5e302c4a01bc02b686234f04be" title="Function to be used with dns_rr_soa_increment_func_int, to increment the soa serial number with a cer...">ldns_soa_serial_increment_by</a>; <a name="l00104"></a>00104 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (! strtok(optarg, <span class="stringliteral">"0123456789"</span>)) { <a name="l00105"></a>00105 soa_serial_increment_func_data = <a name="l00106"></a>00106 atoi(optarg); <a name="l00107"></a>00107 soa_serial_increment_func = <a name="l00108"></a>00108 <a class="code" href="rr__functions_8c.html#a0f6fcc6bf5661b508574e40d00b9e842">ldns_soa_serial_identity</a>; <a name="l00109"></a>00109 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcasecmp(optarg, <span class="stringliteral">"YYYYMMDDxx"</span>)){ <a name="l00110"></a>00110 soa_serial_increment_func = <a name="l00111"></a>00111 <a class="code" href="rr__functions_8c.html#afcb078ca6781a053fef735635f8dec22" title="Function to be used with ldns_rr_soa_increment_func or ldns_rr_soa_increment_func_int to set the soa ...">ldns_soa_serial_datecounter</a>; <a name="l00112"></a>00112 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!strcasecmp(optarg, <span class="stringliteral">"unixtime"</span>)){ <a name="l00113"></a>00113 soa_serial_increment_func = <a name="l00114"></a>00114 <a class="code" href="rr__functions_8c.html#a0e665ffe453d7aeefa9087ec0112bdcd" title="Function to be used with ldns_rr_soa_increment_func or ldns_rr_soa_increment_func_int to set the soa ...">ldns_soa_serial_unixtime</a>; <a name="l00115"></a>00115 } <span class="keywordflow">else</span> { <a name="l00116"></a>00116 fprintf(stderr, <span class="stringliteral">"-S expects a number "</span> <a name="l00117"></a>00117 <span class="stringliteral">"optionally preceded by a "</span> <a name="l00118"></a>00118 <span class="stringliteral">"+ or - sign to indicate an "</span> <a name="l00119"></a>00119 <span class="stringliteral">"offset, or the text YYYYMM"</span> <a name="l00120"></a>00120 <span class="stringliteral">"DDxx or unixtime\n"</span>); <a name="l00121"></a>00121 exit(EXIT_FAILURE); <a name="l00122"></a>00122 } <a name="l00123"></a>00123 <span class="keywordflow">break</span>; <a name="l00124"></a>00124 } <a name="l00125"></a>00125 } <a name="l00126"></a>00126 <a name="l00127"></a>00127 argc -= optind; <a name="l00128"></a>00128 argv += optind; <a name="l00129"></a>00129 <a name="l00130"></a>00130 <span class="keywordflow">if</span> (argc == 0) { <a name="l00131"></a>00131 fp = stdin; <a name="l00132"></a>00132 } <span class="keywordflow">else</span> { <a name="l00133"></a>00133 filename = argv[0]; <a name="l00134"></a>00134 <a name="l00135"></a>00135 fp = fopen(filename, <span class="stringliteral">"r"</span>); <a name="l00136"></a>00136 <span class="keywordflow">if</span> (!fp) { <a name="l00137"></a>00137 fprintf(stderr, <span class="stringliteral">"Unable to open %s: %s\n"</span>, filename, strerror(errno)); <a name="l00138"></a>00138 exit(EXIT_FAILURE); <a name="l00139"></a>00139 } <a name="l00140"></a>00140 } <a name="l00141"></a>00141 <a name="l00142"></a>00142 s = <a class="code" href="zone_8c.html#accd66901157e00acd3b4b571aa7092b8">ldns_zone_new_frm_fp_l</a>(&z, fp, NULL, 0, <a class="code" href="rr_8h.html#adc72070b39f210fae670577de8136600a2ad89c0befc939420e3b1157c07a8b46" title="the Internet">LDNS_RR_CLASS_IN</a>, &line_nr); <a name="l00143"></a>00143 <a name="l00144"></a>00144 <span class="keywordflow">if</span> (strip) { <a name="l00145"></a>00145 stripped_list = <a class="code" href="rr_8c.html#aa7405c3451df02516f62f6197ff06268" title="creates a new rr_list structure.">ldns_rr_list_new</a>(); <a name="l00146"></a>00146 <span class="keywordflow">while</span> ((cur_rr = <a class="code" href="rr_8c.html#a09395bafcd69ac1267639c3fa81e8b0f" title="pops the last rr from an rrlist.">ldns_rr_list_pop_rr</a>(<a class="code" href="zone_8c.html#a5a75b7744ea0d91770d579730a84bbf9" title="Get a list of a zone's content.">ldns_zone_rrs</a>(z)))) { <a name="l00147"></a>00147 cur_rr_type = <a class="code" href="rr_8c.html#a849c616b8e8d87b8c047a8b41be21228" title="returns the type of the rr.">ldns_rr_get_type</a>(cur_rr); <a name="l00148"></a>00148 <span class="keywordflow">if</span> (cur_rr_type == <a class="code" href="rr_8h.html#a640100112b0009efe3d61bbf799b33daa0dae8d9f8f4684e63ac7665a2a489b4d" title="draft-ietf-dnsext-dnssec-25">LDNS_RR_TYPE_RRSIG</a> || <a name="l00149"></a>00149 cur_rr_type == <a class="code" href="rr_8h.html#a640100112b0009efe3d61bbf799b33daa5413827ac0392a4d65d53b1b7d04f989">LDNS_RR_TYPE_NSEC</a> || <a name="l00150"></a>00150 cur_rr_type == <a class="code" href="rr_8h.html#a640100112b0009efe3d61bbf799b33daa79a5eacdaa6defd52d97a6b205f102f9">LDNS_RR_TYPE_NSEC3</a> || <a name="l00151"></a>00151 cur_rr_type == <a class="code" href="rr_8h.html#a640100112b0009efe3d61bbf799b33daa6ae1d49278325b00ed6f8f5c21ed2c77">LDNS_RR_TYPE_NSEC3PARAM</a> <a name="l00152"></a>00152 ) { <a name="l00153"></a>00153 <a class="code" href="rr_8c.html#a277ccb85853d3c527ff3bc963cdde505" title="frees an RR structure">ldns_rr_free</a>(cur_rr); <a name="l00154"></a>00154 } <span class="keywordflow">else</span> { <a name="l00155"></a>00155 <a class="code" href="rr_8c.html#a8bdc038678e7492ae3facf83283f8d04" title="pushes an rr to an rrlist.">ldns_rr_list_push_rr</a>(stripped_list, cur_rr); <a name="l00156"></a>00156 } <a name="l00157"></a>00157 } <a name="l00158"></a>00158 <a class="code" href="rr_8c.html#a00ae3d3571b0dba3014269b617992492" title="frees an rr_list structure.">ldns_rr_list_free</a>(<a class="code" href="zone_8c.html#a5a75b7744ea0d91770d579730a84bbf9" title="Get a list of a zone's content.">ldns_zone_rrs</a>(z)); <a name="l00159"></a>00159 <a class="code" href="zone_8c.html#a23fd3cc25ccd0ebc76f44746c56480f0" title="Set the zone's contents.">ldns_zone_set_rrs</a>(z, stripped_list); <a name="l00160"></a>00160 } <a name="l00161"></a>00161 <span class="keywordflow">if</span> (only_dnssec) { <a name="l00162"></a>00162 stripped_list = <a class="code" href="rr_8c.html#aa7405c3451df02516f62f6197ff06268" title="creates a new rr_list structure.">ldns_rr_list_new</a>(); <a name="l00163"></a>00163 <span class="keywordflow">while</span> ((cur_rr = <a class="code" href="rr_8c.html#a09395bafcd69ac1267639c3fa81e8b0f" title="pops the last rr from an rrlist.">ldns_rr_list_pop_rr</a>(<a class="code" href="zone_8c.html#a5a75b7744ea0d91770d579730a84bbf9" title="Get a list of a zone's content.">ldns_zone_rrs</a>(z)))) { <a name="l00164"></a>00164 cur_rr_type = <a class="code" href="rr_8c.html#a849c616b8e8d87b8c047a8b41be21228" title="returns the type of the rr.">ldns_rr_get_type</a>(cur_rr); <a name="l00165"></a>00165 <span class="keywordflow">if</span> (cur_rr_type == <a class="code" href="rr_8h.html#a640100112b0009efe3d61bbf799b33daa0dae8d9f8f4684e63ac7665a2a489b4d" title="draft-ietf-dnsext-dnssec-25">LDNS_RR_TYPE_RRSIG</a> || <a name="l00166"></a>00166 cur_rr_type == <a class="code" href="rr_8h.html#a640100112b0009efe3d61bbf799b33daa5413827ac0392a4d65d53b1b7d04f989">LDNS_RR_TYPE_NSEC</a> || <a name="l00167"></a>00167 cur_rr_type == <a class="code" href="rr_8h.html#a640100112b0009efe3d61bbf799b33daa79a5eacdaa6defd52d97a6b205f102f9">LDNS_RR_TYPE_NSEC3</a> || <a name="l00168"></a>00168 cur_rr_type == <a class="code" href="rr_8h.html#a640100112b0009efe3d61bbf799b33daa6ae1d49278325b00ed6f8f5c21ed2c77">LDNS_RR_TYPE_NSEC3PARAM</a> <a name="l00169"></a>00169 ) { <a name="l00170"></a>00170 <a class="code" href="rr_8c.html#a8bdc038678e7492ae3facf83283f8d04" title="pushes an rr to an rrlist.">ldns_rr_list_push_rr</a>(stripped_list, cur_rr); <a name="l00171"></a>00171 } <span class="keywordflow">else</span> { <a name="l00172"></a>00172 <a class="code" href="rr_8c.html#a277ccb85853d3c527ff3bc963cdde505" title="frees an RR structure">ldns_rr_free</a>(cur_rr); <a name="l00173"></a>00173 } <a name="l00174"></a>00174 } <a name="l00175"></a>00175 <a class="code" href="rr_8c.html#a00ae3d3571b0dba3014269b617992492" title="frees an rr_list structure.">ldns_rr_list_free</a>(<a class="code" href="zone_8c.html#a5a75b7744ea0d91770d579730a84bbf9" title="Get a list of a zone's content.">ldns_zone_rrs</a>(z)); <a name="l00176"></a>00176 <a class="code" href="zone_8c.html#a23fd3cc25ccd0ebc76f44746c56480f0" title="Set the zone's contents.">ldns_zone_set_rrs</a>(z, stripped_list); <a name="l00177"></a>00177 } <a name="l00178"></a>00178 <a name="l00179"></a>00179 <span class="keywordflow">if</span> (s == <a class="code" href="error_8h.html#a11f34802bb1624af46054952e3b853afac58492ee3fc8d23f33c79824ed08c465">LDNS_STATUS_OK</a>) { <a name="l00180"></a>00180 <span class="keywordflow">if</span> (canonicalize) { <a name="l00181"></a>00181 <a class="code" href="rr_8c.html#a6e26228733c74b4fb7aacc985a350519" title="converts each dname in a rr to its canonical form.">ldns_rr2canonical</a>(<a class="code" href="zone_8c.html#aae16d59c27e1f2292f8bd87604517e0c" title="Return the soa record of a zone.">ldns_zone_soa</a>(z)); <a name="l00182"></a>00182 <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="rr_8c.html#a7ac3192fe79ba66e47579bb2b267ce05" title="returns the number of rr's in an rr_list.">ldns_rr_list_rr_count</a>(<a class="code" href="zone_8c.html#a5a75b7744ea0d91770d579730a84bbf9" title="Get a list of a zone's content.">ldns_zone_rrs</a>(z)); i++) { <a name="l00183"></a>00183 <a class="code" href="rr_8c.html#a6e26228733c74b4fb7aacc985a350519" title="converts each dname in a rr to its canonical form.">ldns_rr2canonical</a>(<a class="code" href="rr_8c.html#a07b1ccea9f2694b8b88904c543e16783" title="returns a specific rr of an rrlist.">ldns_rr_list_rr</a>(<a class="code" href="zone_8c.html#a5a75b7744ea0d91770d579730a84bbf9" title="Get a list of a zone's content.">ldns_zone_rrs</a>(z), i)); <a name="l00184"></a>00184 } <a name="l00185"></a>00185 } <a name="l00186"></a>00186 <span class="keywordflow">if</span> (sort) { <a name="l00187"></a>00187 <a class="code" href="zone_8c.html#ad929e3b1e4a25f676218a1507a7b4277" title="Sort the rrs in a zone, with the current impl.">ldns_zone_sort</a>(z); <a name="l00188"></a>00188 } <a name="l00189"></a>00189 <a name="l00190"></a>00190 <span class="keywordflow">if</span> (print_soa && <a class="code" href="zone_8c.html#aae16d59c27e1f2292f8bd87604517e0c" title="Return the soa record of a zone.">ldns_zone_soa</a>(z)) { <a name="l00191"></a>00191 <span class="keywordflow">if</span> (soa_serial_increment_func) { <a name="l00192"></a>00192 <a class="code" href="rr__functions_8c.html#a2dc56922e3bef62bc9db11a0b2162833" title="Increment the serial number of the given SOA with the given function using data as an argument for th...">ldns_rr_soa_increment_func_int</a>( <a name="l00193"></a>00193 <a class="code" href="zone_8c.html#aae16d59c27e1f2292f8bd87604517e0c" title="Return the soa record of a zone.">ldns_zone_soa</a>(z) <a name="l00194"></a>00194 , soa_serial_increment_func <a name="l00195"></a>00195 , soa_serial_increment_func_data <a name="l00196"></a>00196 ); <a name="l00197"></a>00197 } <a name="l00198"></a>00198 <a class="code" href="host2str_8c.html#afe9595498f147ada7f15e96265ac6e33" title="Prints the data in the resource record to the given file stream (in presentation format)">ldns_rr_print_fmt</a>(stdout, fmt, <a class="code" href="zone_8c.html#aae16d59c27e1f2292f8bd87604517e0c" title="Return the soa record of a zone.">ldns_zone_soa</a>(z)); <a name="l00199"></a>00199 } <a name="l00200"></a>00200 <a class="code" href="host2str_8c.html#a365fd4fa828fbb0330aa60f524e7ceb9" title="print a rr_list to output">ldns_rr_list_print_fmt</a>(stdout, fmt, <a class="code" href="zone_8c.html#a5a75b7744ea0d91770d579730a84bbf9" title="Get a list of a zone's content.">ldns_zone_rrs</a>(z)); <a name="l00201"></a>00201 <a name="l00202"></a>00202 <a class="code" href="zone_8c.html#a84e80b82e10bbc6939ecdfd556674c1a" title="Frees the allocated memory for the zone, the soa rr in it, and the rr_list structure in it...">ldns_zone_deep_free</a>(z); <a name="l00203"></a>00203 } <span class="keywordflow">else</span> { <a name="l00204"></a>00204 fprintf(stderr, <span class="stringliteral">"%s at %d\n"</span>, <a name="l00205"></a>00205 <a class="code" href="error_8c.html#a4005bb78082a40de485f947470fa5017" title="look up a descriptive text by each error.">ldns_get_errorstr_by_id</a>(s), <a name="l00206"></a>00206 line_nr); <a name="l00207"></a>00207 exit(EXIT_FAILURE); <a name="l00208"></a>00208 } <a name="l00209"></a>00209 fclose(fp); <a name="l00210"></a>00210 <a name="l00211"></a>00211 exit(EXIT_SUCCESS); <a name="l00212"></a>00212 } </pre></div></div> </div> <hr class="footer"/><address class="footer"><small>Generated on Wed Jan 11 2012 for ldns by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address> </body> </html>