⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atoasr.3

📁 This a good VPN source
💻 3
字号:
.TH IPSEC_ATOASR 3 "11 June 2001".\" RCSID $Id: atoasr.3,v 1.10 2004/04/09 18:00:38 mcr Exp $.SH NAMEipsec atoasr \- convert ASCII to Internet address, subnet, or range.bripsec rangetoa \- convert Internet address range to ASCII.SH SYNOPSIS.B "#include <freeswan.h>.sp.B "const char *atoasr(const char *src, size_t srclen,".ti +1c.B "char *type, struct in_addr *addrs);".br.B "size_t rangetoa(struct in_addr *addrs, int format,.ti +1c.B "char *dst, size_t dstlen);".SH DESCRIPTIONThese functions are obsolete;there is no current equivalent,because so far they have not proved useful..PP.I Atoasrconverts an ASCII address, subnet, or address rangeinto a suitable combination of binary addresses(in network byte order)..I Rangetoaconverts an address range back into ASCII,using dotted-decimal form for the addresses(the other reverse conversions are handled by.IR ipsec_addrtoa (3)and.IR ipsec_subnettoa (3))..PPA single address can be any form acceptable to.IR ipsec_atoaddr (3):dotted decimal, DNS name, or hexadecimal number.A subnetspecification uses the form \fInetwork\fB/\fImask\fRinterpreted by.IR ipsec_atosubnet (3)..PPAn address range is two.IR ipsec_atoaddr (3)addresses separated by a.B ...delimiter.If there are four dots rather than three, the first is taken aspart of the begin address,e.g. for a complete DNS name which ends with.B .to suppress completion attempts.The begin address of a range must beless than or equal to the end address..PPThe.I srclenparameter of.I atoasrspecifies the length of the ASCII string pointed to by.IR src ;it is an error for there to be anything else(e.g., a terminating NUL) within that length.As a convenience for cases where an entire NUL-terminated string isto be converted,a.I srclenvalue of.B 0is taken to mean.BR strlen(src) ..PPThe.I typeparameter of.I atoasrmust point to a.B charvariable used to record which form was found.The.I addrsparameter must point to a two-element array of.B "struct in_addr"which receives the results.The values stored into.BR *type ,and the corresponding values in the array, are:.PP.ta 3c +2c +3c	*type	addrs[0]	addrs[1].sp 0.8address	\&\fB'a'\fR	address	-.brsubnet	\&\fB's'\fR	network	mask.brrange	\&\fB'r'\fR	begin	end.PPThe.I dstlenparameter of.I rangetoaspecifies the size of the.I dstparameter;under no circumstances are more than.I dstlenbytes written to.IR dst .A result which will not fit is truncated..I Dstlencan be zero, in which case.I dstneed not be valid and no result is written,but the return value is unaffected;in all other cases, the (possibly truncated) result is NUL-terminated.The.I freeswan.hheader file defines a constant,.BR RANGETOA_BUF ,which is the size of a buffer just large enough for worst-case results..PPThe.I formatparameter of.I rangetoaspecifies what format is to be used for the conversion.The value.B 0(not the ASCII character.BR '0' ,but a zero value)specifies a reasonable default,and is in fact the only format currently available.This parameter is a hedge against future needs..PP.I Atoasrreturns NULL for success anda pointer to a string-literal error message for failure;see DIAGNOSTICS..I Rangetoareturns.B 0for a failure, and otherwisealways returns the size of buffer which would be needed toaccommodate the full conversion result, including terminating NUL;it is the caller's responsibility to check this against the size ofthe provided buffer to determine whether truncation has occurred..SH SEE ALSOipsec_atoaddr(3), ipsec_atosubnet(3).SH DIAGNOSTICSFatal errors in.I atoasrare:empty input;error in.IR ipsec_atoaddr (3)or.IR ipsec_atosubnet (3)during conversion;begin address of range exceeds end address..PPFatal errors in.I rangetoaare:unknown format..SH HISTORYWritten for the FreeS/WAN project by Henry Spencer..SH BUGSThe restriction of error reports to literal strings(so that callers don't need to worry about freeing them or copying them)does limit the precision of error reporting..PPThe error-reporting convention lends itselfto slightly obscure code,because many readers will not think of NULL as signifying success.A good way to make it clearer is to write something like:.PP.RS.nf.B "const char *error;".sp.B "error = atoasr( /* ... */ );".B "if (error != NULL) {".B "        /* something went wrong */".fi.RE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -