\doxysection{Milter.\+dns.\+Session Class Reference}
\label{classMilter_1_1dns_1_1Session}\index{Milter.dns.Session@{Milter.dns.Session}}
Inheritance diagram for Milter.\+dns.\+Session\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classMilter_1_1dns_1_1Session}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{classMilter_1_1dns_1_1Session_aba691f835ff819ac842c97815c06ef56}} 
def {\bfseries \+\_\+\+\_\+init\+\_\+\+\_\+} (self)
\item 
def \textbf{ dns} (self, name, qtype, cnames=None)
\begin{DoxyCompactList}\small\item\em Cached D\+NS lookup. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1dns_1_1Session_a00c9f58025adc6951ccf82636dea74d5}} 
def {\bfseries dns\+\_\+txt} (self, domainname, enc=\textquotesingle{}ascii\textquotesingle{})
\end{DoxyCompactItemize}
\doxysubsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{classMilter_1_1dns_1_1Session_a9429eda973bb379c04984b3c4f115052}} 
{\bfseries cache}
\end{DoxyCompactItemize}
\doxysubsection*{Static Public Attributes}
\begin{DoxyCompactItemize}
\item 
\textbf{ S\+A\+F\+E2\+C\+A\+C\+HE}
\begin{DoxyCompactList}\small\item\em Additional D\+NS R\+Rs we can safely cache. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
\begin{DoxyVerb}A Session object has a simple cache with no TTL that is valid
 for a single "session", for example an SMTP conversation.\end{DoxyVerb}
 

\doxysubsection{Member Function Documentation}
\mbox{\label{classMilter_1_1dns_1_1Session_aaa45a3f01503b841ab4f40f964a17e3d}} 
\index{Milter.dns.Session@{Milter.dns.Session}!dns@{dns}}
\index{dns@{dns}!Milter.dns.Session@{Milter.dns.Session}}
\doxysubsubsection{dns()}
{\footnotesize\ttfamily def Milter.\+dns.\+Session.\+dns (\begin{DoxyParamCaption}\item[{}]{self,  }\item[{}]{name,  }\item[{}]{qtype,  }\item[{}]{cnames = {\ttfamily None} }\end{DoxyParamCaption})}



Cached D\+NS lookup. 


\begin{DoxyParams}{Parameters}
{\em name} & the D\+NS label to query \\
\hline
{\em qtype} & the query type, e.\+g. \textquotesingle{}A\textquotesingle{} \\
\hline
{\em cnames} & tracks C\+N\+A\+M\+ES already followed in recursive calls \begin{DoxyVerb}DNS query.

If the result is in cache, return that.  Otherwise pull the
result from DNS, and cache ALL answers, so additional info
is available for further queries later.

CNAMEs are followed.

If there is no data, [] is returned.

pre: qtype in ['A', 'AAAA', 'MX', 'PTR', 'TXT', 'SPF']
post: isinstance(__return__, types.ListType)
\end{DoxyVerb}
 \\
\hline
\end{DoxyParams}


References Milter.\+dns.\+Session.\+cache, Milter.\+cache.\+Addr\+Cache.\+cache, Milter.\+dns.\+Session.\+dns(), and Milter.\+dns.\+D\+N\+S\+Lookup().



Referenced by Milter.\+dns.\+Session.\+dns().



\doxysubsection{Member Data Documentation}
\mbox{\label{classMilter_1_1dns_1_1Session_a06e8cb309df6a76740b612a6afd31671}} 
\index{Milter.dns.Session@{Milter.dns.Session}!SAFE2CACHE@{SAFE2CACHE}}
\index{SAFE2CACHE@{SAFE2CACHE}!Milter.dns.Session@{Milter.dns.Session}}
\doxysubsubsection{SAFE2CACHE}
{\footnotesize\ttfamily Milter.\+dns.\+Session.\+S\+A\+F\+E2\+C\+A\+C\+HE\hspace{0.3cm}{\ttfamily [static]}}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{=  frozenset((}
\DoxyCodeLine{    (\textcolor{stringliteral}{'MX'},\textcolor{stringliteral}{'MX'}), (\textcolor{stringliteral}{'MX'},\textcolor{stringliteral}{'A'}),}
\DoxyCodeLine{    (\textcolor{stringliteral}{'CNAME'},\textcolor{stringliteral}{'CNAME'}), (\textcolor{stringliteral}{'CNAME'},\textcolor{stringliteral}{'A'}),}
\DoxyCodeLine{    (\textcolor{stringliteral}{'A'},\textcolor{stringliteral}{'A'}),}
\DoxyCodeLine{    (\textcolor{stringliteral}{'AAAA'},\textcolor{stringliteral}{'AAAA'}),}
\DoxyCodeLine{    (\textcolor{stringliteral}{'PTR'},\textcolor{stringliteral}{'PTR'}),}
\DoxyCodeLine{    (\textcolor{stringliteral}{'NS'},\textcolor{stringliteral}{'NS'}), (\textcolor{stringliteral}{'NS'},\textcolor{stringliteral}{'A'}),}
\DoxyCodeLine{    (\textcolor{stringliteral}{'TXT'},\textcolor{stringliteral}{'TXT'}),}
\DoxyCodeLine{    (\textcolor{stringliteral}{'SPF'},\textcolor{stringliteral}{'SPF'})}
\DoxyCodeLine{  ))}

\end{DoxyCode}


Additional D\+NS R\+Rs we can safely cache. 

We have to be careful which additional D\+NS R\+Rs we cache. For instance, P\+TR records are controlled by the connecting IP, and they could poison our local cache with bogus A and MX records. ~\newline
 Each entry is a tuple of (query\+\_\+type,rr\+\_\+type). So for instance, the entry (\textquotesingle{}MX\textquotesingle{},\textquotesingle{}A\textquotesingle{}) says it is safe (for milter purposes) to cache any \textquotesingle{}A\textquotesingle{} R\+Rs found in an \textquotesingle{}MX\textquotesingle{} query. 

The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
Milter/dns.\+py\end{DoxyCompactItemize}
