📄 syntax.html
字号:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"><html><head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="Mozilla/4.72C-CCK-MCD Caldera Systems OpenLinux [en] (X11; U; Linux 2.2.14 i686) [Netscape]"> <title>OpenSLP Programmers Guide - Syntax</title></head><body text="#000000" bgcolor="#FFFFFF" link="#0000EF" vlink="#51188E" alink="#FF0000"><h2>SLP Syntaxes</h2><hr WIDTH="100%"><h3><a NAME="Service Type"></a>SLP Service Type Syntax</h3>The official definition of Service Type strings can be found in <a href="../../rfc/rfc2609.txt">RFC2609</a>, "Service Templates and Service Schemes". If you will beworking with "well known" (IANA) service types, you should read it. If you are developing applications for "proprietary" services then youwill probably be satisfied with the following explanation:<blockquote><b>Service-Type = "service:"<abstract-type.naming-authority>":"<concrete-type></b></blockquote>The abstract-type is simple (hopefully short) descriptive string that describesthe type of service. The naming-authority is the name (hopefullyunique) name of the organization that named the service. The naming-authorityis optional, but if it is omitted then IANA is assumed to be the namingauthority and IANA requires service-types to be registered (see RFC 2609). The concrete-type is also optional. Think of a concrete-type as akind of sub-type of the abstract-type. For example, "printer" isan abstract type (owned by IANA) and "printer:lpr" is a concrete type (ownedby IANA).<h4>Service Type Examples</h4>"weather.nasa:wtp" - A (fictitious) weather service type owned byNASA that uses WTP protocol<br>"weather.nasa:swtp" - A (fictitious) weather service type owned by NASAthat uses SWTP protocol.<br>"chat.superchat" - A chat service type owned by SuperChat<br>"printer.samba" - A samba printer service type<br>"ftp" - An IANA ftp service type<br>"telnet" - An IANA telnet service type<h4>Comparing Service Types</h4>Since service types are an important in determining the urls that are returnby the <tt><a href="SLPFindSrvs.html">SLPFindSrvs()</a></tt> call you shouldunderstand how OpenSLP compares services. Suppose that three serviceswere registered with <tt><a href="SLPReg.html">SLPReg()</a></tt> usinga <tt>srvtype</tt> of "printer:lpr", "printer" and "printer.acme". If a client program calls <tt><a href="SLPFindSrvs.html">SLPFindSrvs()</a></tt>with a <tt>srvtype</tt> of "service:printer" the urls for both "printer:lpr"and "printer" are returned ("printer.acme" is not). However, if <tt><a href="SLPFindSrvs.html">SLPFindSrvs()</a></tt>is called with <tt>srvtype </tt>of "printer:lpr" or "printer.acme" thenthe urls for "printer:lpr" or "printer.acme" would be returned. Inother words, if a concrete type is used, only services with same abstractand concrete type are returned. If only the abstract type is usedthen all services of that abstract type (and naming authority) are returned.<h4>A word about naming authorities</h4>It is our opinion that developers MUST use a naming authority if an IANAservice template has not been defined that fits the type of service thatis being supplied by their application. If developers use a predefinedIANA service template they must use it correctly.<h3><a NAME="Service Url"></a>SLP Service Url Syntax</h3>URL strings passed as parameters to<tt> <a href="SLPReg.html">SLPReg()</a></tt>,<tt><a href="SLPDereg.html">SLPDeReg()</a></tt>,<tt><a href="SLPDelAttrs.html">SLPDelAttrs()</a></tt>,<tt><a href="SLPFindSrvs.html">SLPFindSrvs()</a></tt>,<tt><a href="SLPParseSrvURL.html">SLPParseSrvURL()</a></tt>functions and returned as a result to the <tt><a href="SLPSrvURLCallback.html">SLPSrvURLCallback()</a></tt>callback function. SLP defines a special type of URL called a ServiceURL that MUST be used when calling OpenSLP API functions. If youdecide to use Service URLs extensively, you should probably read <a href="rfc/rfc2609.txt">RFC2609</a>, but if you just want to know what they look like, the followingexplanation should be good enough:<blockquote><b><tt>SLP Service URL = "service:"<service-type>"://"<addrspec></tt></b></blockquote>The <tt>service-type</tt> is a service type as explained above. <tt>addrspec</tt>can be just about anything you want that fits URL syntax ( ) and can be translated as a network location. The "<tt>service:</tt>"and "<tt>://</tt>" strings are required.<h4>Service URL Examples</h4>"service:weather.nasa:wtp://weather.nasa.com:12000"<br>"service:weather.nasa:swtp://weather.nasa.com:12001"<br>"service:chat.superchat://chat.superchat.com;auth=ldap"<h4>Do I have to use the SLP Service URL syntax for my urls?</h4>Yes. With OpenSLP you are required to use Service URLs, API functionswill return SLP_PARSE_ERROR if you do not. The reason that OpenSLPrequires Service URLs is because the SLP API designers do not allow theservice-type to be passed in as a parameter to the SLPDeReg() call. With out the service-type, SLPDeReg() does not allow the caller to distinguishbetween services of varying types that were registered with the same standardURL.<br> <h3><a NAME="LDAPv3 Filter"></a>LDAPv3 Search Filter Syntax</h3>An LDAP Search Filter string is passed parameter to the <a href="SLPFindSrvs.html">SLPFindSrvs()</a>function. If you want the definitive explanation of LDAP3 searchfilters you can read <a href="../../rfc/rfc2254.txt">RFC 2254</a>, "StringRepresentation of LDAP Search Filters", or you can read the following definitionthat should be good enough for most applications.<br> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -