Network Working Group                                          J. Kempf
Request for Comments: 2614                                   E. Guttman
Category: Informational                                Sun Microsystems
                                                              June 1999
        
Network Working Group                                          J. Kempf
Request for Comments: 2614                                   E. Guttman
Category: Informational                                Sun Microsystems
                                                              June 1999
        

An API for Service Location

服务定位的API

Status of This Memo

关于下段备忘

This memo provides information for the Internet community. It does not specify an Internet standard of any kind. Distribution of this memo is unlimited.

本备忘录为互联网社区提供信息。它没有规定任何类型的互联网标准。本备忘录的分发不受限制。

Abstract

摘要

The Service Location Protocol (SLP) provides a new way for clients to dynamically discovery network services. With SLP, it is simple to offer highly available services that require no user configuration or assistance from network administrators prior to use. This document describes standardized APIs for SLP in C and Java. The APIs are modular and are designed to allow implementations to offer just the feature set needed. In addition, standardized file formats for configuration and serialized registrations are defined, allowing SLP agents to set network and other parameters in a portable way. The serialized file format allows legacy services to be registered with SLP directory agents in cases where modifying the legacy service program code is difficult or impossible, and to portably exchange a registration database.

服务定位协议(SLP)为客户端动态发现网络服务提供了一种新的方式。有了SLP,就可以简单地提供高可用性服务,在使用前不需要用户配置或网络管理员的帮助。本文档描述了C和Java中用于SLP的标准化API。API是模块化的,旨在允许实现只提供所需的功能集。此外,还定义了用于配置和序列化注册的标准化文件格式,允许SLP代理以可移植的方式设置网络和其他参数。序列化文件格式允许在难以或不可能修改遗留服务程序代码的情况下向SLP目录代理注册遗留服务,并可移植地交换注册数据库。

Table of Contents

目录

    1. Introduction                                                    4
        1.1. Goals  . . . . . . . . . . . . . . . . . . . . . . . .    4
        1.2. Terminology  . . . . . . . . . . . . . . . . . . . . .    4
    2. File Formats                                                    7
        2.1. Configuration File Format  . . . . . . . . . . . . . .    8
              2.1.1. DA configuration   . . . . . . . . . . . . . .    9
              2.1.2. Static Scope Configuration . . . . . . . . . .    9
              2.1.3. Tracing and Logging  . . . . . . . . . . . . .   11
              2.1.4. Serialized Proxy Registrations . . . . . . . .   11
              2.1.5. Network Configuration Properties . . . . . . .   12
              2.1.6. SA Configuration . . . . . . . . . . . . . . .   14
              2.1.7. UA Configuration . . . . . . . . . . . . . . .   14
              2.1.8. Security   . . . . . . . . . . . . . . . . . .   15
        2.2. Multihomed Machines. . . . . . . . . . . . . . . . . .   16
        2.3. Serialized Registration File . . . . . . . . . . . . .   16
        
    1. Introduction                                                    4
        1.1. Goals  . . . . . . . . . . . . . . . . . . . . . . . .    4
        1.2. Terminology  . . . . . . . . . . . . . . . . . . . . .    4
    2. File Formats                                                    7
        2.1. Configuration File Format  . . . . . . . . . . . . . .    8
              2.1.1. DA configuration   . . . . . . . . . . . . . .    9
              2.1.2. Static Scope Configuration . . . . . . . . . .    9
              2.1.3. Tracing and Logging  . . . . . . . . . . . . .   11
              2.1.4. Serialized Proxy Registrations . . . . . . . .   11
              2.1.5. Network Configuration Properties . . . . . . .   12
              2.1.6. SA Configuration . . . . . . . . . . . . . . .   14
              2.1.7. UA Configuration . . . . . . . . . . . . . . .   14
              2.1.8. Security   . . . . . . . . . . . . . . . . . .   15
        2.2. Multihomed Machines. . . . . . . . . . . . . . . . . .   16
        2.3. Serialized Registration File . . . . . . . . . . . . .   16
        
        2.4. Processing Serialized Registration and Configuration
             Files  . . . . . . . . . . . . . . . . . . . . . . . .   18
    3. Binding Independent Implementation Considerations              18
        3.1. Multithreading . . . . . . . . . . . . . . . . . . . .   18
        3.2. Asynchronous and Incremental . . . . . . . . . . . . .   19
        3.3. Type Checking for Service Types. . . . . . . . . . . .   19
        3.4. Refreshing Registrations . . . . . . . . . . . . . . .   19
        3.5. Configuration File Processing  . . . . . . . . . . . .   19
        3.6. Attribute Types  . . . . . . . . . . . . . . . . . . .   20
        3.7. Removal of Duplicates  . . . . . . . . . . . . . . . .   20
        3.8. Character Set Encoding . . . . . . . . . . . . . . . .   20
        3.9. Error Semantics  . . . . . . . . . . . . . . . . . . .   20
       3.10. Modular Implementations  . . . . . . . . . . . . . . .   24
       3.11. Handling Special Service Types . . . . . . . . . . . .   24
       3.12. Scope Discovery and Handling . . . . . . . . . . . . .   24
    4. C Language Binding                                             25
        4.1. Constant Types . . . . . . . . . . . . . . . . . . . .   26
              4.1.1. URL Lifetimes. . . . . . . . . . . . . . . . .   26
              4.1.2. Error Codes. . . . . . . . . . . . . . . . . .   26
              4.1.3. SLPBoolean . . . . . . . . . . . . . . . . . .   27
        4.2. Struct Types   . . . . . . . . . . . . . . . . . . . .   28
              4.2.1. SLPSrvURL  . . . . . . . . . . . . . . . . . .   28
              4.2.2. SLPHandle  . . . . . . . . . . . . . . . . . .   29
        4.3. Callbacks  . . . . . . . . . . . . . . . . . . . . . .   29
              4.3.1. SLPRegReport   . . . . . . . . . . . . . . . .   30
              4.3.2. SLPSrvTypeCallback . . . . . . . . . . . . . .   30
              4.3.3. SLPSrvURLCallback  . . . . . . . . . . . . . .   31
              4.3.4. SLPAttrCallback  . . . . . . . . . . . . . . .   33
        4.4. Opening and Closing an SLPHandle . . . . . . . . . . .   34
              4.4.1. SLPOpen. . . . . . . . . . . . . . . . . . . .   34
              4.4.2. SLPClose . . . . . . . . . . . . . . . . . . .   35
        4.5. Protocol API   . . . . . . . . . . . . . . . . . . . .   36
              4.5.1. SLPReg . . . . . . . . . . . . . . . . . . . .   36
              4.5.2. SLPDereg . . . . . . . . . . . . . . . . . . .   37
              4.5.3. SLPDelAttrs  . . . . . . . . . . . . . . . . .   38
              4.5.4. SLPFindSrvTypes. . . . . . . . . . . . . . . .   39
              4.5.5. SLPFindSrvs  . . . . . . . . . . . . . . . . .   41
              4.5.6. SLPFindAttrs . . . . . . . . . . . . . . . . .   42
        4.6. Miscellaneous Functions  . . . . . . . . . . . . . . .   43
              4.6.1. SLPGetRefreshInterval  . . . . . . . . . . . .   44
              4.6.2. SLPFindScopes  . . . . . . . . . . . . . . . .   44
              4.6.3. SLPParseSrvURL . . . . . . . . . . . . . . . .   45
              4.6.4. SLPEscape  . . . . . . . . . . . . . . . . . .   46
              4.6.5. SLPUnescape  . . . . . . . . . . . . . . . . .   47
              4.6.6. SLPFree  . . . . . . . . . . . . . . . . . . .   48
              4.6.7. SLPGetProperty . . . . . . . . . . . . . . . .   48
              4.6.8. SLPSetProperty . . . . . . . . . . . . . . . .   49
        4.7. Implementation Notes   . . . . . . . . . . . . . . . .   49
        
        2.4. Processing Serialized Registration and Configuration
             Files  . . . . . . . . . . . . . . . . . . . . . . . .   18
    3. Binding Independent Implementation Considerations              18
        3.1. Multithreading . . . . . . . . . . . . . . . . . . . .   18
        3.2. Asynchronous and Incremental . . . . . . . . . . . . .   19
        3.3. Type Checking for Service Types. . . . . . . . . . . .   19
        3.4. Refreshing Registrations . . . . . . . . . . . . . . .   19
        3.5. Configuration File Processing  . . . . . . . . . . . .   19
        3.6. Attribute Types  . . . . . . . . . . . . . . . . . . .   20
        3.7. Removal of Duplicates  . . . . . . . . . . . . . . . .   20
        3.8. Character Set Encoding . . . . . . . . . . . . . . . .   20
        3.9. Error Semantics  . . . . . . . . . . . . . . . . . . .   20
       3.10. Modular Implementations  . . . . . . . . . . . . . . .   24
       3.11. Handling Special Service Types . . . . . . . . . . . .   24
       3.12. Scope Discovery and Handling . . . . . . . . . . . . .   24
    4. C Language Binding                                             25
        4.1. Constant Types . . . . . . . . . . . . . . . . . . . .   26
              4.1.1. URL Lifetimes. . . . . . . . . . . . . . . . .   26
              4.1.2. Error Codes. . . . . . . . . . . . . . . . . .   26
              4.1.3. SLPBoolean . . . . . . . . . . . . . . . . . .   27
        4.2. Struct Types   . . . . . . . . . . . . . . . . . . . .   28
              4.2.1. SLPSrvURL  . . . . . . . . . . . . . . . . . .   28
              4.2.2. SLPHandle  . . . . . . . . . . . . . . . . . .   29
        4.3. Callbacks  . . . . . . . . . . . . . . . . . . . . . .   29
              4.3.1. SLPRegReport   . . . . . . . . . . . . . . . .   30
              4.3.2. SLPSrvTypeCallback . . . . . . . . . . . . . .   30
              4.3.3. SLPSrvURLCallback  . . . . . . . . . . . . . .   31
              4.3.4. SLPAttrCallback  . . . . . . . . . . . . . . .   33
        4.4. Opening and Closing an SLPHandle . . . . . . . . . . .   34
              4.4.1. SLPOpen. . . . . . . . . . . . . . . . . . . .   34
              4.4.2. SLPClose . . . . . . . . . . . . . . . . . . .   35
        4.5. Protocol API   . . . . . . . . . . . . . . . . . . . .   36
              4.5.1. SLPReg . . . . . . . . . . . . . . . . . . . .   36
              4.5.2. SLPDereg . . . . . . . . . . . . . . . . . . .   37
              4.5.3. SLPDelAttrs  . . . . . . . . . . . . . . . . .   38
              4.5.4. SLPFindSrvTypes. . . . . . . . . . . . . . . .   39
              4.5.5. SLPFindSrvs  . . . . . . . . . . . . . . . . .   41
              4.5.6. SLPFindAttrs . . . . . . . . . . . . . . . . .   42
        4.6. Miscellaneous Functions  . . . . . . . . . . . . . . .   43
              4.6.1. SLPGetRefreshInterval  . . . . . . . . . . . .   44
              4.6.2. SLPFindScopes  . . . . . . . . . . . . . . . .   44
              4.6.3. SLPParseSrvURL . . . . . . . . . . . . . . . .   45
              4.6.4. SLPEscape  . . . . . . . . . . . . . . . . . .   46
              4.6.5. SLPUnescape  . . . . . . . . . . . . . . . . .   47
              4.6.6. SLPFree  . . . . . . . . . . . . . . . . . . .   48
              4.6.7. SLPGetProperty . . . . . . . . . . . . . . . .   48
              4.6.8. SLPSetProperty . . . . . . . . . . . . . . . .   49
        4.7. Implementation Notes   . . . . . . . . . . . . . . . .   49
        
              4.7.1. Refreshing Registrations . . . . . . . . . . .   49
              4.7.2. Syntax for String Parameters . . . . . . . . .   49
              4.7.3. Client Side Syntax Checking  . . . . . . . . .   50
              4.7.4. System Properties  . . . . . . . . . . . . . .   50
              4.7.5. Memory Management  . . . . . . . . . . . . . .   51
              4.7.6. Asynchronous and Incremental Return Semantics.   51
        4.8. Example. . . . . . . . . . . . . . . . . . . . . . . .   52
    5. Java Language Binding                                          56
        5.1. Introduction . . . . . . . . . . . . . . . . . . . . .   56
        5.2. Exceptions and Errors  . . . . . . . . . . . . . . . .   56
              5.2.1. Class ServiceLocationException . . . . . . . .   57
        5.3. Basic Data Structures  . . . . . . . . . . . . . . . .   58
              5.3.1. Interface ServiceLocationEnumeration . . . . .   58
              5.3.2. Class ServiceLocationAttribute   . . . . . . .   58
              5.3.3. Class ServiceType  . . . . . . . . . . . . . .   61
              5.3.4. Class ServiceURL   . . . . . . . . . . . . . .   63
        5.4. SLP Access Interfaces  . . . . . . . . . . . . . . . .   67
              5.4.1. Interface Advertiser . . . . . . . . . . . . .   67
              5.4.2. Interface Locator  . . . . . . . . . . . . . .   69
        5.5. The Service Location Manager . . . . . . . . . . . . .   72
              5.5.1. Class ServiceLocationManager . . . . . . . . .   72
        5.6. Service Template Introspection . . . . . . . . . . . .   74
              5.6.1. Abstract Class TemplateRegistry  . . . . . . .   74
              5.6.2. Interface ServiceLocationAttributeVerifier . .   77
              5.6.3. Interface ServiceLocationAttributeDescriptor .   79
        5.7. Implementation Notes . . . . . . . . . . . . . . . . .   81
              5.7.1. Refreshing Registrations . . . . . . . . . . .   81
              5.7.2. Parsing Alternate Transports in ServiceURL . .   81
              5.7.3. String Attribute Values  . . . . . . . . . . .   82
              5.7.4. Client Side Syntax Checking. . . . . . . . . .   82
              5.7.5. Language Locale Handling . . . . . . . . . . .   82
              5.7.6. Setting SLP System Properties. . . . . . . . .   83
              5.7.7. Multithreading . . . . . . . . . . . . . . . .   83
              5.7.8. Modular Implementations  . . . . . . . . . . .   83
              5.7.9. Asynchronous and Incremental Return Semantics.   84
        5.8. Example. . . . . . . . . . . . . . . . . . . . . . . .   85
    6. Internationalization Considerations                            87
        6.1. service URL. . . . . . . . . . . . . . . . . . . . . .   87
        6.2. Character Set Encoding . . . . . . . . . . . . . . . .   87
        6.3. Language Tagging   . . . . . . . . . . . . . . . . . .   88
    7. Security Considerations                                        88
    8. Acknowledgements                                               88
    9. References                                                     89
   10. Authors' Addresses                                             90
   11. Full Copyright Statement                                       91
        
              4.7.1. Refreshing Registrations . . . . . . . . . . .   49
              4.7.2. Syntax for String Parameters . . . . . . . . .   49
              4.7.3. Client Side Syntax Checking  . . . . . . . . .   50
              4.7.4. System Properties  . . . . . . . . . . . . . .   50
              4.7.5. Memory Management  . . . . . . . . . . . . . .   51
              4.7.6. Asynchronous and Incremental Return Semantics.   51
        4.8. Example. . . . . . . . . . . . . . . . . . . . . . . .   52
    5. Java Language Binding                                          56
        5.1. Introduction . . . . . . . . . . . . . . . . . . . . .   56
        5.2. Exceptions and Errors  . . . . . . . . . . . . . . . .   56
              5.2.1. Class ServiceLocationException . . . . . . . .   57
        5.3. Basic Data Structures  . . . . . . . . . . . . . . . .   58
              5.3.1. Interface ServiceLocationEnumeration . . . . .   58
              5.3.2. Class ServiceLocationAttribute   . . . . . . .   58
              5.3.3. Class ServiceType  . . . . . . . . . . . . . .   61
              5.3.4. Class ServiceURL   . . . . . . . . . . . . . .   63
        5.4. SLP Access Interfaces  . . . . . . . . . . . . . . . .   67
              5.4.1. Interface Advertiser . . . . . . . . . . . . .   67
              5.4.2. Interface Locator  . . . . . . . . . . . . . .   69
        5.5. The Service Location Manager . . . . . . . . . . . . .   72
              5.5.1. Class ServiceLocationManager . . . . . . . . .   72
        5.6. Service Template Introspection . . . . . . . . . . . .   74
              5.6.1. Abstract Class TemplateRegistry  . . . . . . .   74
              5.6.2. Interface ServiceLocationAttributeVerifier . .   77
              5.6.3. Interface ServiceLocationAttributeDescriptor .   79
        5.7. Implementation Notes . . . . . . . . . . . . . . . . .   81
              5.7.1. Refreshing Registrations . . . . . . . . . . .   81
              5.7.2. Parsing Alternate Transports in ServiceURL . .   81
              5.7.3. String Attribute Values  . . . . . . . . . . .   82
              5.7.4. Client Side Syntax Checking. . . . . . . . . .   82
              5.7.5. Language Locale Handling . . . . . . . . . . .   82
              5.7.6. Setting SLP System Properties. . . . . . . . .   83
              5.7.7. Multithreading . . . . . . . . . . . . . . . .   83
              5.7.8. Modular Implementations  . . . . . . . . . . .   83
              5.7.9. Asynchronous and Incremental Return Semantics.   84
        5.8. Example. . . . . . . . . . . . . . . . . . . . . . . .   85
    6. Internationalization Considerations                            87
        6.1. service URL. . . . . . . . . . . . . . . . . . . . . .   87
        6.2. Character Set Encoding . . . . . . . . . . . . . . . .   87
        6.3. Language Tagging   . . . . . . . . . . . . . . . . . .   88
    7. Security Considerations                                        88
    8. Acknowledgements                                               88
    9. References                                                     89
   10. Authors' Addresses                                             90
   11. Full Copyright Statement                                       91
        
1. Introduction
1. 介绍

The Service Location API is designed for standardized access to the Service Location Protocol (SLP). The APIs allow client and service programs to be be written or modified in a very simple manner to provide dynamic service discovery and selection. Bindings in the C and Java languages are defined in this document. In addition, standardized formats for configuration files and for serialized registration files are presented. These files allow SLP agents to configure network parameters, to register legacy services that have not been SLP enabled, and to portably exchange registration databases.

服务位置API是为标准化访问服务位置协议(SLP)而设计的。API允许以非常简单的方式编写或修改客户机和服务程序,以提供动态服务发现和选择。本文档中定义了C和Java语言中的绑定。此外,还介绍了配置文件和序列化注册文件的标准格式。这些文件允许SLP代理配置网络参数、注册尚未启用SLP的旧版服务,以及可移植地交换注册数据库。

1.1. Goals
1.1. 目标

The overall goal of the API is to enable source portability of applications that use the API between different implementations of SLP. The result should facilitate the adoption of SLP, and conversion of clients and service programs to SLP.

API的总体目标是实现在不同SLP实现之间使用API的应用程序的源代码可移植性。结果应该有助于采用SLP,并将客户和服务项目转换为SLP。

The goals of the C binding are to create a minimal but complete access to the functionality of the SLP protocol, allowing for simple memory management and limited code size.

C绑定的目标是创建对SLP协议功能的最小但完全的访问,允许简单的内存管理和有限的代码大小。

The Java API provides for modular implementations (where unneeded features can be omitted) and an object oriented interface to the complete set of SLP data and functionality.

JavaAPI提供了模块化实现(可以省略不需要的功能)和一个面向对象的接口,以实现整套SLP数据和功能。

The standardized configuration file and serialized file formats provide a simple syntax with complete functional coverage of the protocol, but without system dependent properties and secure information.

标准化配置文件和序列化文件格式提供了一种简单的语法,具有协议的完整功能,但没有依赖于系统的属性和安全信息。

1.2. Terminology
1.2. 术语

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [1].

本文件中的关键词“必须”、“不得”、“要求”、“应”、“不应”、“应”、“不应”、“建议”、“可”和“可选”应按照RFC 2119[1]中所述进行解释。

Service Location Protocol (SLP)

服务位置协议(SLP)

The underlying protocol allowing dynamic and scalable service discovery. This protocol is specified in the Service Location Protocol Version 2 [7].

允许动态和可扩展服务发现的底层协议。此协议在服务位置协议版本2[7]中指定。

SLP framework

SLP框架

When a 'Service Location framework' is mentioned, it refers to both the SLP implementation and interface implementation; i.e. whatever provides the SLP functionality to user level programs. This includes remote agents.

当提到“服务位置框架”时,它同时指SLP实现和接口实现;i、 e.向用户级程序提供SLP功能的任何内容。这包括远程代理。

Directory Agent (DA)

目录代理(DA)

A service that automatically gathers service advertisements from SAs in order to provide them to UAs.

自动从SAs收集服务广告以提供给UAs的服务。

User Agent (UA)

用户代理(UA)

This is the Service Location process or library that allows SLP requests to be made on behalf of a client process. UAs automatically direct requests to DAs when they exist. In their absence, UAs make requests to SAs.

这是允许代表客户端进程发出SLP请求的服务位置进程或库。当存在请求时,UAs会自动将请求定向到DAs。在他们缺席的情况下,UAs向SAs发出请求。

Service Agent (SA)

服务代理(SA)

This is the Service Location process or library that allows service software to register and deregister itself with the SLP framework. SAs respond to UA service requests, detect DAs and register service advertisements with them.

这是服务定位过程或库,允许服务软件在SLP框架中注册和注销自身。SA响应UA服务请求,检测DAs并向其注册服务广告。

SA Server

SA服务器

Many operating system platforms only allow a single process to listen on a particular port number. Since SAs are required to listen on a multicast address for SLP service requests, implementations of the SLP framework on such platforms that want to support multiple SAs on one machine need to arrange for a single process to do the listening while the advertising SAs communicate with that process through another mechanism. The single listening process is called an SA server. SA servers share many characteristics with DAs, but they are not the same.

许多操作系统平台只允许单个进程侦听特定端口号。由于SA需要侦听SLP服务请求的多播地址,因此在希望在一台机器上支持多个SA的此类平台上的SLP框架的实现需要安排单个进程来进行侦听,同时广告SA通过另一种机制与该进程通信。单个侦听进程称为SA服务器。SA服务器与DAs有许多相同的特性,但它们并不相同。

Service Advertisement

服务广告

A URL possibly combined with service attributes. These are made available to UAs by SAs, either directly or via a DA.

可能与服务属性组合的URL。这些信息由SAs直接或通过DA提供给UAs。

Locale

场所

The language localization that applies to strings passed into or returned from the SLP API. The Locale is expressed using a Language Tag [6]. All attribute strings are associated with a

应用于传入SLP API或从SLP API返回的字符串的语言本地化。区域设置使用语言标记[6]表示。所有属性字符串都与

particular locale. The locale is completely orthogonal to the ANSI C locale. The SLP locale is mapped into the Java locale in the Java API.

特定地区。区域设置与ANSI C区域设置完全正交。SLP语言环境映射到Java API中的Java语言环境。

Service Template

服务模板

A document that describes the syntax of the URL for a given service type and a definition of all service attributes including the meaning, defaults, and constraints on values the attributes may take. See [8] for more information on service templates.

一种文档,描述给定服务类型的URL语法和所有服务属性的定义,包括属性可能采用的值的含义、默认值和约束。有关服务模板的更多信息,请参见[8]。

The service: URL

服务:URL

A service of a particular type announces its availability with a service: URL that includes its service access point (domain name or IP address, and possibly its port number) and optionally basic configuration parameters. The syntax of the service: URL is defined in the service template. Other URL's can be used in service advertisements if desired.

特定类型的服务通过一个服务来宣布其可用性:URL,其中包括其服务访问点(域名或IP地址,可能还有其端口号)和可选的基本配置参数。service:URL的语法在服务模板中定义。如果需要,可以在服务广告中使用其他URL。

Service Attributes

服务属性

The attributes associated with a given service. The values that can be assigned to service attributes are defined by the service template.

与给定服务关联的属性。可以分配给服务属性的值由服务模板定义。

Scope

范围

A string used to control the availability of service advertisements. Every SLP Agent is configured with one or more scope strings. Scopes are assigned by site administrators to group services for many purposes, but chiefly as a means of scalability. DAs store only services advertised having a scope string matching the scopes with which they are configured.

用于控制服务广告可用性的字符串。每个SLP代理都配置有一个或多个作用域字符串。站点管理员将作用域分配给组服务有多种用途,但主要是作为可伸缩性的一种手段。DAs仅存储播发的服务,其作用域字符串与配置它们的作用域相匹配。

Naming Authority (NA)

命名机构(NA)

This is a 'suffix' to the service type string. It completely changes the meaning of the service type. NAs are used for private definitions of well known Service Types and experimental Service Type extensions. The default NA is "IANA", which must not be explicitly included. Service types with the IANA naming authority are registered with the Internet Assigned Numbers Authority (see [8] for more information on the registration procedure).

这是服务类型字符串的“后缀”。它完全改变了服务类型的含义。NAs用于已知服务类型的私有定义和实验性服务类型扩展。默认NA为“IANA”,不得明确包含。IANA命名机构的服务类型向互联网分配号码机构注册(有关注册程序的更多信息,请参见[8])。

2. File Formats
2. 文件格式

This section describes the configuration and serialized registration file formats. Both files are defined in the UTF-8 character set [3].

本节介绍配置和序列化注册文件格式。这两个文件都在UTF-8字符集中定义[3]。

Attribute tags and values in the serialized registration file require SLP reserved characters to be escaped. The SLP reserved characters are `(', `)', `,', `\', `!', `<', `=', `>', `~' and control characters (characters with UTF codes less than 0x0020 and the character 0x007f, which is US-ASCII DEL). The escapes are formed exactly as for the wire protocol, i.e. a backslash followed by two hex digits representing the character. For example, the escape for ' ,' is '\2c'. In addition, the characters `\n', `\r', `\t', and `_' are prohibited from attribute tags by the SLP wire syntax grammar. [7]

序列化注册文件中的属性标记和值要求转义SLP保留字符。SLP保留字符为“(”、“、”、“、”、“!”、“<”、“=”、“>”、“~”和控制字符(UTF代码小于0x0020的字符和字符0x007f,即US-ASCII DEL)。转义符的格式与wire协议完全相同,即反斜杠后跟表示字符的两个十六进制数字。例如,“”的转义是“\2c”。此外,SLP wire语法禁止在属性标记中使用字符“\n”、“r”、“t”和“\u”。[7]

In serialized registration files, escaped strings beginning with `\ff`, an encoding for a nonUTF-8 character, are treated as opaques. Exactly as in the wire protocol, syntactically correct opaque encodings consist of a string beginning with `\ff` and containing *only* escaped characters that are transformed to bytes. Such strings are only syntactically correct in the serialized registration file as attribute values. In other cases, whenever an escape is encountered and the character is not an SLP reserved character, an error is signaled.

在序列化注册文件中,以“\ff”开头的转义字符串(非UTF-8字符的编码)被视为不透明字符。与wire协议中完全相同,语法正确的不透明编码由一个以“\ff”开头的字符串组成,该字符串包含*仅*个转换为字节的转义字符。这些字符串仅在序列化注册文件中作为属性值语法正确。在其他情况下,每当遇到转义且字符不是SLP保留字符时,就会发出错误信号。

Escaped characters in URLs in serialized registration files use the URL escape convention. [2].

序列化注册文件中URL中的转义字符使用URL转义约定。[2].

Property names and values in the configuration file have a few reserved characters that are involved in file's lexical definition. The characters '.' and '=' are reserved in property names and must be escape. The characters ',', '(', and ')' are reserved in property values and must be escaped. In addition, scope names in the net.slp.useScopes property use the SLP wire format escape convention for SLP reserved characters. This simplifies implementation, since the same code can be used to unescape scope names as is used in processing the serialized registration file or for formatting wire messages.

配置文件中的属性名称和值具有几个保留字符,这些字符与文件的词法定义有关。字符“.”和“=”在属性名称中保留,必须转义。字符“、”、“(”和“)”在属性值中保留,必须转义。此外,net.slp.useScopes属性中的作用域名称对slp保留字符使用slp wire格式转义约定。这简化了实现,因为可以使用与处理序列化注册文件或格式化wire消息相同的代码来取消范围名称的范围。

On platforms that only support US-ASCII and not UTF-8, the upper bit of bytes incoming from the configuration and registration files determines whether the character is US-ASCII or not US-ASCII. According to the standard UTF-8 encoding, the upper bit is zero if the character is US-ASCII and one if the character is multibyte and thus not US-ASCII. Platforms without intrinsic UTF-8 support are required to parse the multibyte character and store it in an appropriate internal format. Support for UTF-8 is required to

在仅支持US-ASCII而不支持UTF-8的平台上,从配置和注册文件传入的字节高位决定字符是否为US-ASCII。根据标准UTF-8编码,如果字符为US-ASCII,则高位为零,如果字符为多字节,因此不是US-ASCII,则高位为一。没有内在UTF-8支持的平台需要解析多字节字符并以适当的内部格式存储它。需要对UTF-8的支持才能

implement the SLP protocol (see [7]), and can therefore be used in file processing as well.

实现SLP协议(参见[7]),因此也可以用于文件处理。

The location and name of the configuration file is system-dependent, but implementations of the API are encouraged to locate it together with other configuration files and name it consistently.

配置文件的位置和名称取决于系统,但鼓励API的实现将其与其他配置文件一起定位并统一命名。

2.1. Configuration File Format
2.1. 配置文件格式

The configuration file format consists of a newline delimited list of zero or more property definitions. Each property definition corresponds to a particular configurable SLP, network, or other parameter in one or more of the three SLP agents. The file format grammar in ABNF [5] syntax is:

配置文件格式由零个或多个特性定义的换行分隔列表组成。每个属性定义对应于三个SLP代理中的一个或多个中的特定可配置SLP、网络或其他参数。ABNF[5]语法中的文件格式语法为:

      config-file   =  line-list
      line-list     =  line / line line-list
      line          =  property-line / comment-line
      comment-line  =  ( "#" / ";" ) 1*allchar newline
      property-line =  property newline
      property      =  tag "=" value-list
      tag           =  prop / prop "." tag
      prop          =  1*tagchar
      value-list    =  value / value "," value-list
      value         =  int / bool /
                       "(" value-list ")" / string
      int           =  1*DIGIT
      bool          =  "true" / "false" / "TRUE" / "FALSE"
      newline       =  CR / ( CRLF )
      string        =  1*stringchar
      tagchar       =  DIGIT / ALPHA / tother / escape
      tother        =  %x21-%x2d / %x2f /
                       %x3a / %x3c-%x40 /
                       %x5b-%x60 / %7b-%7e
                       ; i.e., all characters except `.',
                       ; and `='.
      stringchar    =  DIGIT / ALPHA / sother / escape
      sother        =  %x21-%x29 / %x2a-%x2b /
                       %x2d-%x2f / %x3a-%x40 /
                       %x5b-%x60 / %7b-%7e
                       ; i.e., all characters except `,'
      allchar       =  DIGIT / ALPHA / HTAB / SP
      escape        =  "\" HEXDIG HEXDIG
                       ; Used for reserved characters
        
      config-file   =  line-list
      line-list     =  line / line line-list
      line          =  property-line / comment-line
      comment-line  =  ( "#" / ";" ) 1*allchar newline
      property-line =  property newline
      property      =  tag "=" value-list
      tag           =  prop / prop "." tag
      prop          =  1*tagchar
      value-list    =  value / value "," value-list
      value         =  int / bool /
                       "(" value-list ")" / string
      int           =  1*DIGIT
      bool          =  "true" / "false" / "TRUE" / "FALSE"
      newline       =  CR / ( CRLF )
      string        =  1*stringchar
      tagchar       =  DIGIT / ALPHA / tother / escape
      tother        =  %x21-%x2d / %x2f /
                       %x3a / %x3c-%x40 /
                       %x5b-%x60 / %7b-%7e
                       ; i.e., all characters except `.',
                       ; and `='.
      stringchar    =  DIGIT / ALPHA / sother / escape
      sother        =  %x21-%x29 / %x2a-%x2b /
                       %x2d-%x2f / %x3a-%x40 /
                       %x5b-%x60 / %7b-%7e
                       ; i.e., all characters except `,'
      allchar       =  DIGIT / ALPHA / HTAB / SP
      escape        =  "\" HEXDIG HEXDIG
                       ; Used for reserved characters
        

With the exception of net.slp.useScopes, net.slp.DAAddresses, and net.slp.isBroadcastOnly, all other properties can be changed through property accessors in the C and Java APIs. The property accessors

除了net.slp.useScopes、net.slp.DAAddresses和net.slp.isBroadcastOnly之外,所有其他属性都可以通过C和Java API中的属性访问器进行更改。属性访问器

only change the property values in the running agent program and do not affect the values in the configuration file. The net.slp.useScopes and net.slp.DAAddresses properties are read-only because they control the agent's view of the scopes and DAs and are therefore critical to the function of the API scope discovery algorithm. Attempts to modify them are unlikely to yield productive results, and could harm the ability of the agent to find scopes and use DAs. The net.slp.isBroadcastOnly property is read-only because the API library needs to configure networking upon start up and changing this property might invalidate the configuration. Whether the local network uses broadcast or multicast is not likely to change during the course of the program's execution.

仅更改正在运行的代理程序中的属性值,而不影响配置文件中的值。net.slp.useScopes和net.slp.DAAddresses属性是只读的,因为它们控制代理对作用域和DAs的视图,因此对API作用域发现算法的功能至关重要。试图修改它们不太可能产生有成效的结果,并且可能会损害代理查找作用域和使用DAs的能力。net.slp.isBroadcastOnly属性是只读的,因为API库需要在启动时配置网络,更改此属性可能会使配置无效。在程序执行过程中,本地网络使用广播还是多播不太可能改变。

The properties break down into the following subsections describes an area and its properties.

属性分为以下小节,描述了一个区域及其属性。

2.1.1. DA configuration
2.1.1. DA配置

Important configuration properties for DAs are included in this section. These are:

DAs的重要配置属性包含在本节中。这些是:

net.slp.isDA

net.slp.isDA

A boolean indicating if the SLP server is to act as a DA. If false, not run as a DA. Default is false.

一个布尔值,指示SLP服务器是否充当DA。如果为false,则不作为DA运行。默认值为false。

net.slp.DAHeartBeat

net.slp.DAHeartBeat

A 32 bit integer giving the number of seconds for the DA heartbeat. Default is 3 hours (10800 seconds). This property corresponds to the protocol specification parameter CONFIG_DA_BEAT [7]. Ignored if isDA is false.

一个32位整数,给出DA心跳的秒数。默认值为3小时(10800秒)。此属性对应于协议规范参数CONFIG_DA_BEAT[7]。如果isDA为false,则忽略。

net.slp.DAAttributes

net.slp.DAAttributes

A comma-separated list of parenthesized attribute/value list pairs that the DA must advertise in DAAdverts. The property must be in the SLP attribute list wire format, including escapes for reserved characters. [7]

以逗号分隔的带括号的属性/值列表对列表,DA必须在DAAdverts中播发。属性必须采用SLP属性列表导线格式,包括保留字符的转义。[7]

2.1.2. Static Scope Configuration
2.1.2. 静态作用域配置

These properties allow various aspects of scope handling to be configured.

这些属性允许配置作用域处理的各个方面。

net.slp.useScopes

net.slp.useScopes

A value-list of strings indicating the only scopes a UA or SA is allowed to use when making requests or registering, or the scopes a DA must support. If not present for the DA and SA, then in the absence of scope information from DHCP, the default scope "DEFAULT" is used. If not present for the UA, and there is no scope information available from DHCP, then the user scoping model is in force. Active and passive DA discovery or SA discovery are used for scope discovery, and the scope "DEFAULT" is used if no other information is available. If a DA or SA gets another scope in a request, a SCOPE_NOT_SUPPORTED error should be returned, unless the request was multicast, in which case it should be dropped. If a DA gets another scope in a registration, a SCOPE_NOT_SUPPORTED error must be returned. Unlike other properties, this property is "read-only", so attempts to change it after the configuration file has been read are ignored. See Section 3.12 for the algorithm the API uses in determining what scope information to present.

字符串的值列表,指示UA或SA在发出请求或注册时允许使用的唯一作用域,或DA必须支持的作用域。如果DA和SA不存在,则在DHCP没有作用域信息的情况下,使用默认作用域“default”。如果UA不存在,并且DHCP没有范围信息可用,则用户作用域模型有效。主动和被动DA发现或SA发现用于范围发现,如果没有其他可用信息,则使用范围“默认值”。如果DA或SA在请求中获得另一个作用域,则应返回不支持作用域的错误,除非该请求是多播的,在这种情况下应将其丢弃。如果DA在注册中获得另一个作用域,则必须返回不支持作用域的错误。与其他属性不同,此属性是“只读”的,因此在读取配置文件后对其进行更改的尝试将被忽略。有关API用于确定要显示哪些范围信息的算法,请参见第3.12节。

net.slp.DAAddresses

net.slp.dadda地址

A value-list of IP addresses or DNS resolvable host names giving the SLPv2 DAs to use for statically configured UAs and SAs. Ignored by DAs (unless the DA is also an SA server). Default is none. Unlike other properties, this property is "read-only", so attempts to change it after the configuration file has been read are ignored.

IP地址或DNS可解析主机名的值列表,提供SLPv2 DAs用于静态配置的UAs和SAs。DAs忽略(除非DA也是SA服务器)。默认值为“无”。与其他属性不同,此属性是“只读”的,因此在读取配置文件后对其进行更改的尝试将被忽略。

The following grammar describes the property:

以下语法描述了该属性:

               addr-list     =  addr / addr "," addr-list
               addr          =  fqdn / hostnumber
               fqdn          =  ALPHA / ALPHA *[ anum / "-" ] anum
               anum          =  ALPHA / DIGIT
               hostnumber    =  1*3DIGIT 3("." 1*3DIGIT)
        
               addr-list     =  addr / addr "," addr-list
               addr          =  fqdn / hostnumber
               fqdn          =  ALPHA / ALPHA *[ anum / "-" ] anum
               anum          =  ALPHA / DIGIT
               hostnumber    =  1*3DIGIT 3("." 1*3DIGIT)
        

An example is:

例如:

sawah,mandi,sambal

萨瓦、曼迪、桑巴尔

IP addresses can be used instead of host names in networks where DNS is not deployed, but network administrators are reminded that using IP addresses will complicate machine

在未部署DNS的网络中,可以使用IP地址而不是主机名,但提醒网络管理员,使用IP地址会使机器复杂化

renumbering, since the SLP configuration property files in statically configured networks will have to be changed. Similarly, if host names are used, implementors must be careful that a name service is available before SLP starts, in other words, SLP cannot be used to find the name service.

重新编号,因为必须更改静态配置网络中的SLP配置属性文件。类似地,如果使用主机名,则实现人员必须小心,在SLP启动之前,名称服务可用,换句话说,SLP不能用于查找名称服务。

2.1.3. Tracing and Logging
2.1.3. 追踪和记录

This section allows tracing and logging information to be printed by the various agents.

本节允许各种代理打印跟踪和日志信息。

net.slp.traceDATraffic

net.slp.traceDATraffic

A boolean controlling printing of messages about traffic with DAs. Default is false.

通过DAs控制有关流量的消息打印的布尔值。默认值为false。

net.slp.traceMsg

net.slp.traceMsg

A boolean controlling printing of details on SLP messages. The fields in all incoming messages and outgoing replies are printed. Default is false.

控制SLP消息上详细信息打印的布尔值。将打印所有传入消息和传出答复中的字段。默认值为false。

net.slp.traceDrop

net.slp.traceDrop

A boolean controlling printing details when a SLP message is dropped for any reason. Default is false.

一个布尔值,用于控制由于任何原因删除SLP消息时打印详细信息。默认值为false。

net.slp.traceReg

net.slp.traceReg

A boolean controlling dumps of all registered services upon registration and deregistration. If true, the contents of the DA or SA server are dumped after a registration or deregistration occurs. Default is false.

一个布尔值,用于在注册和注销时控制所有已注册服务的转储。如果为true,则DA或SA服务器的内容将在注册或取消注册后转储。默认值为false。

2.1.4. Serialized Proxy Registrations
2.1.4. 序列化代理注册

These properties control the reading and writing of serialized registrations.

这些属性控制序列化注册的读写。

net.slp.serializedRegURL

net.slp.serializedRegURL

A string containing a URL pointing to a document containing serialized registrations that should be processed when the DA or SA server starts up. Default is none.

包含URL的字符串,该URL指向一个文档,该文档包含在DA或SA服务器启动时应处理的序列化注册。默认值为“无”。

2.1.5. Network Configuration Properties
2.1.5. 网络配置属性

The properties in this section allow various network configuration properties to be set.

本节中的属性允许设置各种网络配置属性。

net.slp.isBroadcastOnly

仅限net.slp.isbroadcasting

A boolean indicating if broadcast should be used instead of multicast. Like the net.slp.useScopes and net.slp.DAAddresses properties, this property is "read-only", so attempts to change it after the configuration file has been read are ignored. Default is false.

一个布尔值,指示是否应使用广播而不是多播。与net.slp.useScopes和net.slp.DAAddresses属性一样,此属性是“只读”的,因此在读取配置文件后更改此属性的尝试将被忽略。默认值为false。

net.slp.passiveDADetection

net.slp.passivedDetection

A boolean indicating whether passive DA detection should be used. Default is true.

指示是否应使用被动DA检测的布尔值。默认值为true。

net.slp.multicastTTL

net.slp.multicasttl

A positive integer less than or equal to 255, giving the multicast TTL. Default is 255.

小于或等于255的正整数,表示多播TTL。默认值为255。

net.slp.DAActiveDiscoveryInterval

net.slp.DAActiveDiscoveryInterval

A 16 bit positive integer giving the number of seconds between DA active discovery queries. Default is 900 seconds (15 minutes). This property corresponds to the protocol specification parameter CONFIG_DA_FIND [7]. If the property is set to zero, active discovery is turned off. This is useful when the DAs available are explicitly restricted to those obtained from DHCP or the net.slp.DAAddresses property.

一个16位正整数,表示DA活动发现查询之间的秒数。默认值为900秒(15分钟)。此属性对应于协议规范参数CONFIG_DA_FIND[7]。如果属性设置为零,则禁用活动发现。当可用的DAs明确限制为从DHCP或net.slp.DAAddresses属性获得的DAs时,这非常有用。

net.slp.multicastMaximumWait

net.slp.multicast MaximumWait

A 32 bit integer giving the maximum amount of time to perform multicast, in milliseconds. Default is 15000 ms (15 sec.). This property corresponds to the CONFIG_MC_MAX parameter in the protocol specification [7].

32位整数,表示执行多播的最大时间(毫秒)。默认值为15000毫秒(15秒)。此属性对应于协议规范[7]中的CONFIG_MC_MAX参数。

net.slp.multicastTimeouts

net.slp.multicast超时

A value-list of 32 bit integers used as timeouts, in milliseconds, to implement the multicast convergence algorithm. Each value specifies the time to wait before sending the next request, or until nothing new has been learned from two successive requests. Default is: 3000,3000,3000,3000,3000. In a fast network the

32位整数的值列表,用作超时,以毫秒为单位,用于实现多播收敛算法。每个值指定在发送下一个请求之前等待的时间,或者直到从两个连续的请求中没有学到任何新内容为止。默认值为:30003000。在一个快速的网络中

aggressive values of 1000,1250,1500,2000,4000 allow better performance. This property corresponds to the CONFIG_MC_RETRY parameter in the protocol specification [7]. Note that the net.slp.DADiscoveryTimeouts property must be used for active DA discovery.

积极的值10001250150020004000允许更好的性能。此属性对应于协议规范[7]中的CONFIG_MC_RETRY参数。请注意,net.slp.DADiscoveryTimeouts属性必须用于活动DA发现。

net.slp.DADiscoveryTimeouts

net.slp.DADiscoveryTimeouts

A value-list of 32 bit integers used as timeouts, in milliseconds, to implement the multicast convergence algorithm during active DA discovery. Each value specifies the time to wait before sending the next request, or until nothing new has been learned from two successive requests. This property corresponds to the protocol specification parameter CONFIG_RETRY [7]. Default is: 2000,2000,2000,2000,3000,4000.

32位整数的值列表,用作超时,以毫秒为单位,用于在主动DA发现期间实现多播收敛算法。每个值指定在发送下一个请求之前等待的时间,或者直到从两个连续的请求中没有学到任何新内容为止。此属性对应于协议规范参数CONFIG\u RETRY[7]。默认值为:2000200030004000。

net.slp.datagramTimeouts

net.slp.datagramTimeouts

A value-list of 32 bit integers used as timeouts, in milliseconds, to implement unicast datagram transmission to DAs. The nth value gives the time to block waiting for a reply on the nth try to contact the DA. The sum of these values is the protocol specification property CONFIG_RETRY_MAX [7].

32位整数的值列表,用作超时,以毫秒为单位,用于实现到DAs的单播数据报传输。第n个值表示在尝试联系DA的第n个时间点阻止等待回复的时间。这些值的总和是协议规范属性CONFIG\u RETRY\u MAX[7]。

net.slp.randomWaitBound

net.slp.randomWaitBound

A 32 bit integer giving the maximum value for all random wait parameters, in milliseconds. Default is 1000 (1 sec.). This value corresponds to the protocol specification parameters CONFIG_START_WAIT, CONFIG_REG_PASSIVE, and CONFIG_REG_ACTIVE [7].

一个32位整数,给出所有随机等待参数的最大值,以毫秒为单位。默认值为1000(1秒)。该值对应于协议规范参数CONFIG_START_WAIT、CONFIG_REG_PASSIVE和CONFIG_REG_ACTIVE[7]。

net.slp.MTU

net.slp.MTU

A 16 bit integer giving the network packet MTU, in bytes. This is the maximum size of any datagram to send, but the implementation might receive a larger datagram. The maximum size includes IP, and UDP or TCP headers. Default is 1400.

给出网络数据包MTU的16位整数,以字节为单位。这是要发送的任何数据报的最大大小,但实现可能会接收更大的数据报。最大大小包括IP、UDP或TCP标头。默认值为1400。

net.slp.interfaces

net.slp.interfaces

Value-list of strings giving the IP addresses of network interfaces on which the DA or SA should listen on port 427 for multicast, unicast UDP, and TCP messages. Default is empty, i.e. use the default network interface. The grammar for this property is:

字符串的值列表,给出DA或SA应在端口427上侦听多播、单播UDP和TCP消息的网络接口的IP地址。默认值为空,即使用默认网络接口。此属性的语法为:

               addr-list     =  hostnumber / hostnumber "," addr-list
               hostnumber    =  1*3DIGIT 3("." 1*3DIGIT)
        
               addr-list     =  hostnumber / hostnumber "," addr-list
               hostnumber    =  1*3DIGIT 3("." 1*3DIGIT)
        

An example is:

例如:

195.42.42.42,195.42.142.1,195.42.120.1

195.42.42.42,195.42.142.1,195.42.120.1

The example machine has three interfaces on which the DA should listen.

示例机器有三个DA应该侦听的接口。

Note that since this property only takes IP addresses, it will need to be changed if the network is renumbered.

请注意,由于此属性仅接受IP地址,因此如果网络重新编号,则需要更改此属性。

2.1.6. SA Configuration
2.1.6. SA配置

This section contains configuration properties for the SA. These properties are typically set programmatically by the SA, since they are specific to each SA.

本节包含SA的配置属性。这些属性通常由SA以编程方式设置,因为它们特定于每个SA。

net.slp.SAAttributes

net.slp.SAAttributes

A comma-separated list of parenthesized attribute/value list pairs that the SA must advertise in SAAdverts. The property must be in the SLP attribute list wire format, including escapes for reserved characters. [7]

SA必须在SAAdverts中公布的带括号的属性/值列表对的逗号分隔列表。属性必须采用SLP属性列表导线格式,包括保留字符的转义。[7]

2.1.7. UA Configuration
2.1.7. UA配置

This section contains configuration properties for the UA. These properties can be set either programmatically by the UA or in the configuration file.

本节包含UA的配置属性。这些属性可以由UA以编程方式设置,也可以在配置文件中设置。

net.slp.locale

net.slp.locale

A RFC 1766 Language Tag [6] for the language locale. Setting this property causes the property value to become the default locale for SLP messages. Default is "en". This property is also used for SA and DA configuration.

语言区域设置的RFC 1766语言标记[6]。设置此属性会导致属性值成为SLP消息的默认区域设置。默认值为“en”。此属性还用于SA和DA配置。

net.slp.maxResults

net.slp.maxResults

A 32 bit integer giving the maximum number of results to accumulate and return for a synchronous request before the timeout, or the maximum number of results to return through a callback if the request results are reported asynchronously.

一个32位整数,指定超时前同步请求累积和返回的最大结果数,或异步报告请求结果时通过回调返回的最大结果数。

Positive integers and -1 are legal values. If -1, indicates that all results should be returned. Default value is -1.

正整数和-1是法定值。如果为-1,则表示应返回所有结果。默认值为-1。

DAs and SAs always return all results that match the request. This configuration value applies only to UAs, that filter incoming results and only return as many values as net.slp.maxResults indicates.

DAs和SAs始终返回与请求匹配的所有结果。此配置值仅适用于UAs,该UAs过滤传入结果并仅返回net.slp.maxResults所指示的值。

net.slp.typeHint

net.slp.typeHint

A value-list of service type names. In the absence of any DAs, UAs perform SA discovery for finding scopes. These SA discovery requests may contain a request for service types as an attribute.

服务类型名称的值列表。在没有任何DAs的情况下,UAs执行SA发现以查找作用域。这些SA发现请求可能包含服务类型请求作为属性。

The API implementation will use the service type names supplied by this property to discover only those SAs (and their scopes) which support the desired service type or types. For example, if net.slp.typeHint is set to "service:imap,service:pop3" then SA discovery requests will include the search filter:

API实现将使用此属性提供的服务类型名称来发现仅支持所需服务类型的SA(及其作用域)。例如,如果net.slp.typeHint设置为“service:imap,service:pop3”,则SA发现请求将包括搜索筛选器:

         (|(service-type=service:imap)(service-type=service:pop3))
        
         (|(service-type=service:imap)(service-type=service:pop3))
        

The API library can also use unicast to contact the discovered SAs for subsequent requests for these service types, to optimize network access.

API库还可以使用单播与发现的SA联系,以获得这些服务类型的后续请求,从而优化网络访问。

2.1.8. Security
2.1.8. 安全

The property in this section allows security for all agents to be set on or off. When the property is true, then the agent must include security information on all SLP messages transacted by that agent. Since security policy must be set network wide to be effective, a single property controls security for all agents. Key management and management of SLP SPI strings [7] are implementation and policy dependent.

本节中的属性允许打开或关闭所有代理的安全性。当属性为true时,代理必须在该代理处理的所有SLP消息上包含安全信息。由于安全策略必须在网络范围内设置为有效,因此单个属性控制所有代理的安全性。密钥管理和SLP SPI字符串的管理[7]取决于实现和策略。

net.slp.securityEnabled

net.slp.securityEnabled

A boolean indicating whether the agent should enable security for URLs, attribute lists, DAAdverts, and SAAdverts. Each agent is responsible for interpreting the property appropriately. Default is false.

一个布尔值,指示代理是否应为URL、属性列表、DAAD和SAADVERT启用安全性。每个代理都有责任适当地解释该财产。默认值为false。

2.2. Multihomed Machines
2.2. 多宿机器

On multihomed machines, the bandwidth and latency characteristics on different network interfaces may differ considerably, to the point where different configuration properties are necessary to achieve optimal performance. The net.slp.interfaces property indicates which network interfaces are SLP enabled. An API library implementation may support configuration customization on a per network interface basis by allowing the interface IP address to be appended to the property name. In that case, the values of the property are only used for that particular interface, the generic property (or defaults if no generic property is set) applies to all others.

在多主机计算机上,不同网络接口上的带宽和延迟特性可能会有很大差异,以至于需要不同的配置属性才能实现最佳性能。net.slp.interfaces属性指示哪些网络接口已启用slp。API库实现可以通过允许将接口IP地址附加到属性名称来支持基于每个网络接口的配置定制。在这种情况下,属性值仅用于该特定接口,通用属性(如果未设置通用属性,则为默认值)适用于所有其他接口。

For example, if a configuration has the following properties:

例如,如果配置具有以下属性:

net.slp.interfaces=125.196.42.41,125.196.42.42,125.196.42.43 net.slp.multicastTTL.125.196.42.42=1

net.slp.interfaces=125.196.42.41125.196.42.42125.196.42.43 net.slp.multicasttl.125.196.42.42=1

then the network interface on subnet 42 is restricted to a TTL of 1, while the interfaces on the other subnets have the default multicast radius, 255.

然后,子网42上的网络接口被限制为TTL为1,而其他子网上的接口具有默认的多播半径255。

The net.slp.interfaces property must only be set if there is no routing between the interfaces. If the property is set, the DA (if any) and SAs should advertise with the IP address or host name appropriate to the interface on the interfaces in the list. If packets are routed between the interfaces, then the DA and SAs should only advertise on the default interface. The property should also be set if broadcast is used rather than multicast on the subnets connected to the interfaces. Note that even if unicast packets are not routed between the interfaces, multicast may be routed through another router. The danger in listening for multicast on multiple interfaces when multicast packets are routed is that the DA or SA may receive the same multicast request via more than one interface. Since the IP address is different on each interface, the DA or SA cannot identify the request as having already being answered via the previous responder's list. The requesting agent will end up getting URLs that refer to the same DA or service but have different addresses or host names.

只有在接口之间没有路由时,才能设置net.slp.interfaces属性。如果设置了该属性,DA(如果有)和SAs应在列表中的接口上公布适合该接口的IP地址或主机名。如果数据包在接口之间路由,则DA和SAs应仅在默认接口上播发。如果在连接到接口的子网上使用广播而不是多播,则还应设置该属性。注意,即使在接口之间没有路由单播数据包,多播也可以通过另一个路由器路由。路由多播数据包时,在多个接口上侦听多播的危险在于DA或SA可能通过多个接口接收相同的多播请求。由于每个接口上的IP地址不同,DA或SA无法将请求识别为已通过前一响应者列表得到响应。请求代理最终将获得引用相同DA或服务但具有不同地址或主机名的URL。

2.3. Serialized Registration File
2.3. 序列化注册文件

The serialized registration file contains a group of registrations that a DA or SA server (if one exists) registers when it starts up. These registrations are primarily for older service programs that do not internally support SLP and cannot be converted, and for portably

序列化注册文件包含DA或SA服务器(如果存在)在启动时注册的一组注册。这些注册主要针对内部不支持SLP且无法转换的旧服务程序,以及可移植的服务程序

exchanging registrations between SLP implementations. The character encoding of the registrations is required to be UTF-8.

在SLP实现之间交换注册。注册的字符编码要求为UTF-8。

The syntax of the serialized registration file, in ABNF format [5], is as follows:

ABNF格式[5]的序列化注册文件的语法如下:

      ser-file      =  reg-list
      reg-list      =  reg / reg reg-list
      reg           =  creg / ser-reg
      creg          =  comment-line ser-reg
      comment-line  =  ( "#" / ";" ) 1*allchar newline
      ser-reg       =  url-props [slist] [attr-list] newline
      url-props     =  surl "," lang "," ltime [ "," type ] newline
      surl          =  ;The registration's URL. See
                       ; [8] for syntax.
      lang          =  1*8ALPHA [ "-" 1*8ALPHA ]
                       ;RFC 1766 Language Tag see [6].
      ltime         =  1*5DIGIT
                       ; A positive 16-bit integer
                       ; giving the lifetime
                       ; of the registration.
      type          =  ; The service type name, see [7]
                       ; and [8] for syntax.
      slist         =  "scopes" "=" scope-list newline
      scope-list    =  scope-name / scope-name "," scope-list
      scope         =  ; See grammar of [7] for
                       ; scope-name syntax.
      attr-list     =  attr-def / attr-def attr-list
      attr-def      =  ( attr / keyword ) newline
      keyword       =  attr-id
      attr          =  attr-id "=" attr-val-list
      attr-id       =  ;Attribute id, see [7] for syntax.
      attr-val-list =  attr-val / attr-val "," attr-val-list
      attr-val      =  ;Attribute value, see [7] for syntax.
      allchar       =  char / WSP
      char          =  DIGIT / ALPHA / other
      other         =  %x21-%x2f / %x3a-%x40 /
                       %x5b-%x60 / %7b-%7e
                       ; All printable, nonwhitespace US-ASCII
                       ; characters.
      newline       =  CR / ( CRLF )
        
      ser-file      =  reg-list
      reg-list      =  reg / reg reg-list
      reg           =  creg / ser-reg
      creg          =  comment-line ser-reg
      comment-line  =  ( "#" / ";" ) 1*allchar newline
      ser-reg       =  url-props [slist] [attr-list] newline
      url-props     =  surl "," lang "," ltime [ "," type ] newline
      surl          =  ;The registration's URL. See
                       ; [8] for syntax.
      lang          =  1*8ALPHA [ "-" 1*8ALPHA ]
                       ;RFC 1766 Language Tag see [6].
      ltime         =  1*5DIGIT
                       ; A positive 16-bit integer
                       ; giving the lifetime
                       ; of the registration.
      type          =  ; The service type name, see [7]
                       ; and [8] for syntax.
      slist         =  "scopes" "=" scope-list newline
      scope-list    =  scope-name / scope-name "," scope-list
      scope         =  ; See grammar of [7] for
                       ; scope-name syntax.
      attr-list     =  attr-def / attr-def attr-list
      attr-def      =  ( attr / keyword ) newline
      keyword       =  attr-id
      attr          =  attr-id "=" attr-val-list
      attr-id       =  ;Attribute id, see [7] for syntax.
      attr-val-list =  attr-val / attr-val "," attr-val-list
      attr-val      =  ;Attribute value, see [7] for syntax.
      allchar       =  char / WSP
      char          =  DIGIT / ALPHA / other
      other         =  %x21-%x2f / %x3a-%x40 /
                       %x5b-%x60 / %7b-%7e
                       ; All printable, nonwhitespace US-ASCII
                       ; characters.
      newline       =  CR / ( CRLF )
        

The syntax for scope names, attribute tags, and attribute values requires escapes for special characters as specified in [7]. DAs and SA servers that process serialized registrations must handle them exactly as if they were registered by an SA. In the url-props

作用域名称、属性标记和属性值的语法要求对[7]中指定的特殊字符进行转义。处理序列化注册的DAs和SA服务器必须完全按照SA注册的方式处理它们。在url道具中

production, the type token is optional. If the type token is present for a service: URL, a warning is signaled and the type name is ignored. If the maximum lifetime is specified (65535 sec.), the registration is taken to be permanent, and is continually refreshed by the DA or SA server until it exits. Scopes can be included in a registration by including an attribute definition with tag "scopes" followed by a comma separated list of scope names immediately after the url-props production. If the optional scope list is present, the registrations are made in the indicated scopes; otherwise, they are registered in the scopes with which the DA or SA server was configured through the net.slp.useScopes property.

生产时,类型标记是可选的。如果service:URL的类型标记存在,则会发出警告并忽略类型名称。如果指定了最长生存期(65535秒),则注册将被视为永久注册,并由DA或SA服务器持续刷新,直到退出。注册中可以包括作用域,方法是在url props生成之后立即包含一个带有标记“Scopes”的属性定义,后跟一个逗号分隔的作用域名称列表。如果存在可选范围列表,则在指定范围内进行注册;否则,它们将在通过net.slp.useScopes属性配置DA或SA服务器的作用域中注册。

If the scope list contains scopes that are not in the net.slp.useScopes property (provided that property is set) or are not specified by DHCP, the API library should reject the registration and issue a warning message.

如果作用域列表包含的作用域不在net.slp.useScopes属性中(前提是设置了该属性)或未由DHCP指定,则API库应拒绝注册并发出警告消息。

2.4. Processing Serialized Registration and Configuration Files
2.4. 处理序列化的注册和配置文件

Implementations are encouraged to make processing of configuration and serialized files as transparent as possible to clients of the API. At the latest, errors must be caught when the relevant configuration item is used. At the earliest, errors may be caught when the relevant file is loaded into the executing agent. Errors should be reported by logging to the appropriate platform logging file, error output, or log device, and the default value substituted. Serialized registration file entries should be caught and reported when the file is loaded.

鼓励实现使配置和序列化文件的处理对API的客户端尽可能透明。最晚,在使用相关配置项时必须捕获错误。最早,当相关文件加载到执行代理时,可能会发现错误。应通过记录到适当的平台日志文件、错误输出或日志设备来报告错误,并替换默认值。加载文件时,应捕获并报告序列化的注册文件条目。

Configuration file loading must be complete prior to the initiation of the first networking connection. Serialized registration must be complete before the DA accepts the first network request.

配置文件加载必须在启动第一个网络连接之前完成。在DA接受第一个网络请求之前,必须完成序列化注册。

3. Binding Independent Implementation Considerations
3. 绑定独立的实现注意事项

This section discusses a number of implementation considerations independent of language binding, with language specific notes where applicable.

本节讨论了一些独立于语言绑定的实现注意事项,并在适用的情况下提供了特定于语言的注释。

3.1. Multithreading
3.1. 多线程

Implementations of both the C and Java APIs are required to make API calls thread-safe. Access to data structures shared between threads must be co-ordinated to avoid corruption or invalid access. One way to achieve this goal is to allow only one thread at a time in the implementing library. Performance in such an implementation suffers, however. Therefore, where possible, implementations are encouraged to allow multiple threads within the SLP API library.

为了使API调用线程安全,需要同时实现C和Java API。必须协调对线程之间共享的数据结构的访问,以避免损坏或无效访问。实现此目标的一种方法是在实现库中一次只允许一个线程。但是,这种实现的性能会受到影响。因此,在可能的情况下,建议实现允许SLP API库中有多个线程。

3.2. Asynchronous and Incremental
3.2. 异步和增量

The APIs are designed to encourage implementations supporting asynchronous and incremental client interaction. The goal is to allow large numbers of returned service URLs, service types, and attributes without requiring the allocation of huge chunks of memory. The particular design features to support this goal differ in the two language bindings.

这些API旨在鼓励支持异步和增量客户端交互的实现。目标是允许返回大量服务URL、服务类型和属性,而无需分配大量内存。支持此目标的特定设计特性在两种语言绑定中有所不同。

3.3. Type Checking for Service Types
3.3. 服务类型的类型检查

Service templates [8] allow SLP registrations to be type checked for correctness. Implementations of the API are free to make use of service type information for type checking, but are not required to do so. If a type error occurs, the registration should terminate with TYPE_ERROR.

服务模板[8]允许对SLP注册的正确性进行类型检查。API的实现可以自由地使用服务类型信息进行类型检查,但不需要这样做。如果发生类型错误,注册应以类型错误终止。

3.4. Refreshing Registrations
3.4. 刷新注册

SLP advertisements carry an explicit lifetime with them. After the lifetime expires, the DA flushes the registration from its cache. In some cases, an application may want to have the URL continue being registered for the entire time during which the application is executing. The API includes provision for clients to indicate whether they want URLs to be automatically refreshed. Implementations of the SA API must provide this automatic refreshing capability. Note that a client which uses this facility should explicitly deregister the service URL before exiting, since the API implementation may not be able to assure that the URL is deregistered when the application exits, although it will time out in the DA eventually.

SLP广告具有明确的生命周期。生存期到期后,DA将从其缓存中刷新注册。在某些情况下,应用程序可能希望在应用程序执行的整个时间内继续注册URL。该API为客户端提供了指示它们是否希望自动刷新URL的功能。SA API的实现必须提供这种自动刷新功能。请注意,使用此功能的客户端应该在退出之前显式取消注册服务URL,因为API实现可能无法确保在应用程序退出时取消注册URL,尽管它最终将在DA中超时。

3.5. Configuration File Processing
3.5. 配置文件处理

DAs, SAs and UAs processing the configuration file, and DAs and SA servers processing the serialized registration file are required to log any errors using whatever underlying error mechanism is appropriate for the platform. Examples include writing error messages to the standard output, writing to a system logging device, or displaying the errors to a logging window. After the error is reported, the offending property must be set to the default and program execution continued. An agent MUST NOT fail if a file format error occurs.

处理配置文件的DAs、SAs和UAs,以及处理序列化注册文件的DAs和SA服务器都需要使用适用于平台的任何底层错误机制记录任何错误。示例包括将错误消息写入标准输出、写入系统日志记录设备或将错误显示到日志记录窗口。报告错误后,必须将有问题的属性设置为默认值,并继续执行程序。如果发生文件格式错误,代理程序不得失败。

3.6. Attribute Types
3.6. 属性类型

String encoded attribute values do not include explicit type information. All UA implementations and those SA and DA implementations that choose to support type checking should use the type rules described in [8] in order to convert from the string representation on the wire to an object typed appropriately.

字符串编码的属性值不包含显式类型信息。所有UA实现以及选择支持类型检查的SA和DA实现都应使用[8]中描述的类型规则,以便从线上的字符串表示转换为适当类型的对象。

3.7. Removal of Duplicates
3.7. 删除重复项

The UA implementation SHOULD always collate results to remove duplicates during synchronous operations and for the Java API. During asynchronous operation in C, the UA implementation SHOULD forgo duplicate elimination to reduce memory requirements in the library. This allows the API library to simply take the returned attribute value list strings, URL strings, or service type list strings and call the callback function with it, without any additional processing. Naturally, the burden of duplicate elimination is thrown onto the client in this case.

UA实现应始终整理结果,以便在同步操作期间和Java API中删除重复项。在C中的异步操作期间,UA实现应该放弃重复消除,以减少库中的内存需求。这允许API库简单地获取返回的属性值列表字符串、URL字符串或服务类型列表字符串,并使用它调用回调函数,而无需任何额外处理。当然,在这种情况下,重复消除的负担就落到了客户身上。

3.8. Character Set Encoding
3.8. 字符集编码

Character string parameters in the Java API are all represented in Unicode internally because that is the Java-supported character set. Characters buffer parameters in the C API are represented in UTF-8 to maintain maximum compatibility on platforms that only support US-ASCII and not UTF-8. API functions are still required to handle the full range of UTF-8 characters because the SLP protocol requires it, but the API implementation can represent the characters internally in any convenient way. On the wire, all characters are converted to UTF-8. Inside URLs, characters that are not allowed by URL syntax [2] must be escaped according to the URL escape character convention. Strings that are included in SLP messages may include SLP reserved characters and can be escaped by clients through convenience functions provided by the API. The character encoding used in escapes is UTF-8.

Java API中的字符串参数都在内部以Unicode表示,因为这是Java支持的字符集。C API中的字符缓冲区参数以UTF-8表示,以在仅支持US-ASCII而不支持UTF-8的平台上保持最大的兼容性。由于SLP协议需要,因此仍然需要API函数来处理所有UTF-8字符,但API实现可以以任何方便的方式在内部表示字符。在线路上,所有字符都转换为UTF-8。在URL内部,必须根据URL转义字符约定转义URL语法[2]不允许的字符。SLP消息中包含的字符串可能包括SLP保留字符,客户端可以通过API提供的便利函数进行转义。转义中使用的字符编码是UTF-8。

Due to constraints in SLP, no string parameter passed to the C or Java API may exceed 64K bytes in length.

由于SLP中的限制,传递给C或Java API的字符串参数的长度不得超过64K字节。

3.9. Error Semantics
3.9. 错误语义

All errors encountered processing SLP messages should be logged. For synchronous calls, an error is only reported on a call if no successful replies were received from any SLP framework entity. If an error occurred among one of several successful replies, then the error should be logged and the successful replies returned. For asynchronous calls, an error occurring during correspondence with a

应记录处理SLP消息时遇到的所有错误。对于同步调用,只有在没有从任何SLP framework实体收到成功答复的情况下,才会在调用中报告错误。如果多个成功回复中的一个出现错误,则应记录错误并返回成功回复。对于异步调用,在与

particular remote SLP agent is reported through the first callback (in the C API) or enumeration method invocation (in the Java API) after the error occurs, which would normally report the results of the correspondence. This allows the callback or client code to determine whether the operation should be terminated or continue. In some cases, the error returned from the SLP framework may be fatal (SLP_PARSE_ERROR, etc.). In these cases, the API library terminates the operation.

错误发生后,通过第一次回调(在C API中)或枚举方法调用(在Java API中)报告特定的远程SLP代理,这通常会报告通信的结果。这允许回调或客户端代码确定操作是应该终止还是继续。在某些情况下,从SLP框架返回的错误可能是致命的(SLP_PARSE_error,等等)。在这些情况下,API库终止操作。

Both the Java and C APIs contain language specific error code mechanisms for returning error information. The names of the error codes are consistent between the two implementations, however.

Java和C API都包含用于返回错误信息的特定于语言的错误代码机制。但是,两种实现之间的错误代码名称是一致的。

The following error codes are returned from a remote agent (DA or SA server):

从远程代理(DA或SA服务器)返回以下错误代码:

LANGUAGE_NOT_SUPPORTED

不支持语言

No DA or SA has service advertisement or attribute information in the language requested, but at least one DA or SA indicated, via the LANGUAGE_NOT_SUPPORTED error code, that it might have information for that service in another language.

没有DA或SA具有所请求语言的服务广告或属性信息,但至少有一个DA或SA通过“语言不支持”错误代码表示可能具有另一种语言的服务信息。

PARSE_ERROR

解析错误

The SLP message was rejected by a remote SLP agent. The API returns this error only when no information was retrieved, and at least one SA or DA indicated a protocol error. The data supplied through the API may be malformed or a may have been damaged in transit.

远程SLP代理拒绝了SLP消息。只有在未检索到任何信息且至少有一个SA或DA指示协议错误时,API才会返回此错误。通过API提供的数据可能格式不正确,或者在传输过程中可能已损坏。

INVALID_REGISTRATION

注册无效

The API may return this error if an attempt to register a service was rejected by all DAs because of a malformed URL or attributes. SLP does not return the error if at least one DA accepted the registration.

如果由于URL或属性格式错误而导致注册服务的尝试被所有DAs拒绝,则API可能会返回此错误。如果至少有一个DA接受注册,则SLP不会返回错误。

AUTHENTICATION_ABSENT

认证不存在

If the SLP framework supports authentication, this error arises when the UA or SA failed to send an authenticator for requests or registrations in a protected scope.

如果SLP框架支持身份验证,则当UA或SA未能为受保护范围内的请求或注册发送身份验证程序时,会出现此错误。

INVALID_UPDATE

无效的\u更新

An update for a non-existing registration was issued, or the update includes a service type or scope different than that in the initial registration, etc.

已发布不存在注册的更新,或更新包含与初始注册不同的服务类型或范围,等等。

The following errors result from interactions with remote agents or can occur locally:

以下错误由与远程代理的交互导致,或可能在本地发生:

AUTHENTICATION_FAILED

身份验证失败

If the SLP framework supports authentication, this error arises when a authentication on an SLP message failed.

如果SLP框架支持身份验证,则在SLP消息的身份验证失败时会出现此错误。

SCOPE_NOT_SUPPORTED

不支持作用域

The API returns this error if the SA has been configured with net.slp.useScopes value-list of scopes and the SA request did not specify one or more of these allowable scopes, and no others. It may be returned by a DA or SA if the scope included in a request is not supported by the DA or SA.

如果SA已配置了net.slp.useScopes值范围列表,且SA请求未指定一个或多个允许的范围,且未指定其他范围,则API将返回此错误。如果DA或SA不支持请求中包含的范围,则DA或SA可能会返回该范围。

REFRESH_REJECTED

刷新被拒绝

The SA attempted to refresh a registration more frequently than the minimum refresh interval. The SA should call the appropriate API function to obtain the minimum refresh interval to use.

SA尝试刷新注册的频率高于最小刷新间隔。SA应调用适当的API函数以获得要使用的最小刷新间隔。

The following errors are generated through a program interacting with the API implementation. They do not involve a remote SLP agent.

以下错误是通过与API实现交互的程序生成的。它们不涉及远程SLP代理。

NOT_IMPLEMENTED

未实施

If an unimplemented feature is used, this error is returned.

如果使用了未实现的功能,则返回此错误。

NETWORK_INIT_FAILED

网络初始化失败

If the network cannot initialize properly, this error is returned.

如果网络无法正确初始化,则返回此错误。

NETWORK_TIMED_OUT

网络超时

When no reply can be obtained in the time specified by the configured timeout interval for a unicast request, this error is returned.

在单播请求的配置超时间隔指定的时间内无法获得回复时,将返回此错误。

NETWORK_ERROR

网络错误

The failure of networking during normal operations causes this error to be returned.

正常操作期间的网络故障会导致返回此错误。

BUFFER_OVERFLOW

缓冲区溢出

An outgoing request overflowed the maximum network MTU size. The request should be reduced in size or broken into pieces and tried again.

传出请求溢出了最大网络MTU大小。请求的大小应减小或分成几部分,然后重试。

MEMORY_ALLOC_FAILED

内存分配失败

If the API fails to allocate memory, the operation is aborted and returns this.

如果API无法分配内存,则操作将中止并返回此消息。

PARAMETER_BAD

参数_坏

If a parameter passed into an interface is bad, this error is returned.

如果传入接口的参数不正确,则返回此错误。

INTERNAL_SYSTEM_ERROR

内部系统错误

A basic failure of the API causes this error to be returned. This occurs when a system call or library fails. The operation could not recover.

API的基本故障导致返回此错误。当系统调用或库失败时会发生这种情况。操作无法恢复。

HANDLE_IN_USE

在使用中处理

In the C API, callback functions are not permitted to recursively call into the API on the same SLPHandle, either directly or indirectly. If an attempt is made to do so, this error is returned from the called API function.

在C API中,回调函数不允许直接或间接地递归调用同一SLPHandle上的API。如果尝试执行此操作,则从调用的API函数返回此错误。

TYPE_ERROR

类型错误

If the API supports type checking of registrations against service type templates, this error can arise if the attributes in a registration do not match the service type template for the service.

如果API支持根据服务类型模板对注册进行类型检查,则如果注册中的属性与服务的服务类型模板不匹配,则会出现此错误。

Some error codes are handled differently in the Java API. These differences are discussed in Section 5.

一些错误代码在JavaAPI中的处理方式不同。这些差异将在第5节中讨论。

The SLP protocol errors OPTION_NOT_UNDERSTOOD, VERSION_NOT_SUPPORTED, INTERNAL_ERROR, MSG_NOT_SUPPORTED, AUTHENTICATON_UNKNOWN, and DA_BUSY_NOW should be handled internally and not surfaced to clients through the API.

SLP协议错误选项\u不被理解、版本\u不被支持、内部\u错误、消息\u不被支持、身份验证\u未知和数据繁忙\u现在应该在内部处理,而不是通过API向客户端显示。

3.10. Modular Implementations
3.10. 模块化实现

Subset implementations that do not support the full range of functionality are required to nevertheless support every interface in order to maintain link compatibility between compliant API implementations and applications. If a particular operation is not supported, a NOT_IMPLEMENTED error should be returned. The Java API has some additional conventions for handling subsets. Applications that are expected to run on a wide variety of platforms should be prepared for subset API implementations by checking returned error codes.

不支持全部功能的子集实现需要支持每个接口,以保持兼容API实现和应用程序之间的链接兼容性。如果不支持特定操作,则应返回未实现的错误。JavaAPI有一些处理子集的附加约定。应通过检查返回的错误代码,为在各种平台上运行的应用程序的子集API实现做好准备。

3.11. Handling Special Service Types
3.11. 处理特殊服务类型

The service types service:directory-agent and service:service-agent are used internally in the SLP framework to discover DAs and SAs. The mechanism of DA and SA discovery is not normally exposed to the API client; however, the client may have interest in discovering DAs and SAs independently of their role in discovering other services. For example, a network management application may want to determine which machines are running SLP DAs. To facilitate that, API implementations must handle requests to find services and attributes for these two service types so that API clients obtain the information they expect.

服务类型service:directory-agent和service:service-agent在SLP框架内部用于发现DAs和SAs。DA和SA发现机制通常不向API客户端公开;但是,客户可能对发现DAs和SAs感兴趣,而不依赖于它们在发现其他服务中的角色。例如,网络管理应用程序可能希望确定哪些机器正在运行SLP DAs。为了实现这一点,API实现必须处理查找这两种服务类型的服务和属性的请求,以便API客户机获得他们期望的信息。

In particular, if the UA is using a DA, SrvRqst and AttrRqst for these service types must be multicast and not unicast to the DA, as is the case for other service types. If the requests are not multicast, the DA will respond with an empty reply to a request for services of type service:service-agent and with its URL only to a request for services of type service:directory-agent. The UA would therefore not obtain a complete picture of the available DAs and SAs.

特别是,如果UA使用DA,这些服务类型的SrvRqst和ATTRQST必须是多播的,而不是单播到DA,就像其他服务类型一样。如果请求不是多播的,DA将对service:service agent类型的服务请求做出空响应,并且其URL仅对service:directory agent类型的服务请求做出响应。因此,UA无法获得可用DAs和SAs的完整信息。

3.12. Scope Discovery and Handling
3.12. 范围发现和处理

Both APIs contain an operation to obtain a list of currently known scope names. This scope information comes from a variety of places: DHCP, the net.slp.useScopes property, unicast to DAs configured via DHCP or the net.slp.DAAddresses property, and active and passive discovery.

这两个API都包含获取当前已知作用域名称列表的操作。此作用域信息来自多个位置:DHCP、net.slp.useScopes属性、通过DHCP或net.slp.DAAddresses属性配置的DAs单播,以及主动和被动发现。

The API is required to be implemented in a way that re-enforces the administrative and user scoping models described in [7]. SA clients only support the administrative scoping model. SAs must know a priori what DAs they need to register with since there is typically no human intervention in scope selection for SAs. UAs must support both administrative and user scoping because an application may require human intervention in scope selection.

API的实现方式必须能够重新实施[7]中所述的管理和用户范围界定模型。SA客户端仅支持管理范围模型。SAs必须事先知道他们需要注册哪些DAs,因为SAs的范围选择通常没有人为干预。UAs必须同时支持管理范围和用户范围,因为应用程序可能需要人工干预范围选择。

API implementations are required to support administrative scoping in the following way. Scopes configured by DHCP and scopes of DAs configured by DHCP have first priority (in that order) and must be returned if they are available. The net.slp.useScopes property has second priority, and scopes discovered through the net.slp.useScopes property must be returned if this property is set and there are no scopes available from DHCP. If scopes are not available from either of these sources and the net.slp.DAAddresses property is set, then the scopes available from the configured DAs must be returned. Note that if both DAs and scopes are configured, the scopes of the configured DAs must match the configured scope list; otherwise and error is signaled and agent execution is terminated. If no configured scope information is available, then an SA client has default scope, "DEFAULT", and a UA client employs user scoping.

API实现需要以以下方式支持管理作用域。由DHCP配置的作用域和由DHCP配置的DAs的作用域具有第一优先级(按该顺序),如果它们可用,则必须返回。net.slp.useScopes属性具有第二优先级,如果设置了此属性并且DHCP中没有可用的作用域,则必须返回通过net.slp.useScopes属性发现的作用域。如果这些源中的任何一个都无法提供作用域,并且设置了net.slp.DAAddresses属性,则必须返回已配置DAs中可用的作用域。注意,如果同时配置了DAs和作用域,则配置的DAs的作用域必须与配置的作用域列表匹配;否则,将发出错误信号并终止代理执行。如果没有可用的配置范围信息,则SA客户端具有默认范围“default”,UA客户端使用用户范围。

User scoping is supported in the following way. Scopes discovered from active DA discovery, and from passive DA discovery all must be returned. If no information is available from active and passive DA discovery, then the API library may perform SA discovery, using the service types in the net.slp.typeHint property to limit the search to SAs supporting particular service types. If no net.slp.typeHint property is set, the UA may perform SA discovery without any service type query. In the absence of any of the above sources of information, the API must return the default scope, "DEFAULT". Note that the API must always return some scope information.

通过以下方式支持用户作用域。从主动DA发现和被动DA发现中发现的作用域都必须返回。如果没有来自主动和被动DA发现的信息,则API库可以执行SA发现,使用net.slp.typeHint属性中的服务类型将搜索限制为支持特定服务类型的SA。如果未设置net.slp.typeHint属性,UA可以在不进行任何服务类型查询的情况下执行SA发现。如果没有上述任何信息源,API必须返回默认范围“default”。请注意,API必须始终返回一些范围信息。

SLP requires that SAs must perform their operations in all scopes currently known to them. [7]. The API enforces this constraint by not requiring the API client to supply any scopes as parameters to API operations. The API library must obtain all currently known scopes and use them in SA operations. UA API clients should use a scope obtained through one of the API operations for finding scopes. Any other scope name may result in a SCOPE_NOT_SUPPORTED error from a remote agent. The UA API library can optionally check the scope and return the error without contacting a remote agent.

SLP要求SA必须在其当前已知的所有作用域中执行其操作。[7]. API通过不要求API客户机提供任何作用域作为API操作的参数来实施此约束。API库必须获取所有当前已知的作用域,并在SA操作中使用它们。UA API客户端应该使用通过API操作之一获得的作用域来查找作用域。任何其他作用域名称都可能导致远程代理出现不支持作用域的错误。UA API库可以选择检查范围并返回错误,而无需联系远程代理。

4. C Language Binding
4. C语言绑定

The C language binding presents a minimal overhead implementation that maps directly into the protocol. There is one C language function per protocol request, with the exception of the SLPDereg() and SLPDelAttrs() functions, which map into different uses of the SLP deregister request. Parameters are for the most part character buffers. Memory management is kept simple by having the client allocate most memory and requiring that client callback functions copy incoming parameters into memory allocated by the client code. Any memory returned directly from the API functions is deallocated using the SLPFree() function.

C语言绑定提供了直接映射到协议的最小开销实现。每个协议请求都有一个C语言函数,但SLPDereg()和SLPDelAttrs()函数除外,它们映射到SLP注销请求的不同用途。参数主要用于字符缓冲区。通过让客户机分配大部分内存,并要求客户机回调函数将传入的参数复制到客户机代码分配的内存中,可以简化内存管理。直接从API函数返回的任何内存都将使用SLPFree()函数释放。

To conform with standard C practice, all character strings passed to and returned through the API are null terminated, even though the SLP protocol does not use null terminated strings. Strings passed as parameters are UTF-8 but they may still be passed as a C string (a null terminated sequence of bytes.) Escaped characters must be encoded by the API client as UTF-8. In the common case of US-ASCII, the usual one byte per character C strings work. API functions assist in escaping and unescaping strings.

为了符合标准C实践,通过API传递和返回的所有字符串都以null结尾,即使SLP协议不使用以null结尾的字符串。作为参数传递的字符串是UTF-8,但它们仍然可以作为C字符串(以null结尾的字节序列)传递。API客户端必须将转义字符编码为UTF-8。在US-ASCII的常见情况下,通常每个字符一个字节的C字符串起作用。API函数有助于转义和取消转义字符串。

Unless otherwise noted, parameters to API functions and callbacks are non-NULL. Some parameters may have other restrictions. If any parameter fails to satisfy the restrictions on its value, the operation returns a PARAMETER_BAD error.

除非另有说明,API函数和回调的参数都是非空的。某些参数可能有其他限制。如果任何参数未能满足对其值的限制,则操作将返回一个参数\u BAD error。

4.1. Constant Types
4.1. 常量类型
4.1.1. URL Lifetimes
4.1.1. URL生存期
4.1.1.1. Synopsis
4.1.1.1. 提要
   typedef enum {
     SLP_LIFETIME_DEFAULT = 10800,
     SLP_LIFETIME_MAXIMUM = 65535
   } SLPURLLifetime;
        
   typedef enum {
     SLP_LIFETIME_DEFAULT = 10800,
     SLP_LIFETIME_MAXIMUM = 65535
   } SLPURLLifetime;
        
4.1.1.2. Description
4.1.1.2. 描述

The SLPURLLifetime enum type contains URL lifetime values, in seconds, that are frequently used. SLP_LIFETIME_DEFAULT is 3 hours, while SLP_LIFETIME_MAXIMUM is about 18 hours and corresponds to the maximum size of the lifetime field in SLP messages.

SLPURLLifetime枚举类型包含经常使用的URL生存期值(以秒为单位)。SLP_LIFETIME_默认值为3小时,而SLP_LIFETIME_最大值约为18小时,对应于SLP消息中LIFETIME字段的最大大小。

4.1.2. Error Codes
4.1.2. 错误代码
4.1.2.1. Synopsis
4.1.2.1. 提要
   typedef enum {
     SLP_LAST_CALL                    = 1,
     SLP_OK                           = 0,
     SLP_LANGUAGE_NOT_SUPPORTED       = -1,
     SLP_PARSE_ERROR                  = -2,
     SLP_INVALID_REGISTRATION         = -3,
     SLP_SCOPE_NOT_SUPPORTED          = -4,
     SLP_AUTHENTICATION_ABSENT        = -6,
     SLP_AUTHENTICATION_FAILED        = -7,
        
   typedef enum {
     SLP_LAST_CALL                    = 1,
     SLP_OK                           = 0,
     SLP_LANGUAGE_NOT_SUPPORTED       = -1,
     SLP_PARSE_ERROR                  = -2,
     SLP_INVALID_REGISTRATION         = -3,
     SLP_SCOPE_NOT_SUPPORTED          = -4,
     SLP_AUTHENTICATION_ABSENT        = -6,
     SLP_AUTHENTICATION_FAILED        = -7,
        
     SLP_INVALID_UPDATE               = -13,
     SLP_REFRESH_REJECTED             = -15,
     SLP_NOT_IMPLEMENTED              = -17,
     SLP_BUFFER_OVERFLOW              = -18,
     SLP_NETWORK_TIMED_OUT            = -19,
     SLP_NETWORK_INIT_FAILED          = -20,
     SLP_MEMORY_ALLOC_FAILED          = -21,
     SLP_PARAMETER_BAD                = -22,
     SLP_NETWORK_ERROR                = -23,
     SLP_INTERNAL_SYSTEM_ERROR        = -24,
     SLP_HANDLE_IN_USE                = -25,
     SLP_TYPE_ERROR                   = -26
   } SLPError ;
        
     SLP_INVALID_UPDATE               = -13,
     SLP_REFRESH_REJECTED             = -15,
     SLP_NOT_IMPLEMENTED              = -17,
     SLP_BUFFER_OVERFLOW              = -18,
     SLP_NETWORK_TIMED_OUT            = -19,
     SLP_NETWORK_INIT_FAILED          = -20,
     SLP_MEMORY_ALLOC_FAILED          = -21,
     SLP_PARAMETER_BAD                = -22,
     SLP_NETWORK_ERROR                = -23,
     SLP_INTERNAL_SYSTEM_ERROR        = -24,
     SLP_HANDLE_IN_USE                = -25,
     SLP_TYPE_ERROR                   = -26
   } SLPError ;
        
4.1.2.2. Description
4.1.2.2. 描述

The SLPError enum contains error codes that are returned from API functions.

SLPEROR枚举包含从API函数返回的错误代码。

The SLP_OK code indicates that the no error occurred during the operation.

SLP_OK代码表示操作过程中未发生错误。

The SLP_LAST_CALL code is passed to callback functions when the API library has no more data for them and therefore no further calls will be made to the callback on the currently outstanding operation. The callback can use this to signal the main body of the client code that no more data will be forthcoming on the operation, so that the main body of the client code can break out of data collection loops. On the last call of a callback during both a synchronous and asynchronous call, the error code parameter has value SLP_LAST_CALL, and the other parameters are all NULL. If no results are returned by an API operation, then only one call is made, with the error parameter set to SLP_LAST_CALL.

当API库没有更多数据时,SLP_LAST_调用代码将传递给回调函数,因此不会对当前未完成的操作进行进一步调用。回调可以使用它向客户机代码主体发出信号,表示操作中将不会有更多数据,这样客户机代码主体就可以脱离数据收集循环。在同步和异步调用期间的回调的最后一次调用中,error code参数的值为SLP_last_call,其他参数均为NULL。如果API操作未返回任何结果,则只进行一次调用,错误参数设置为SLP_LAST_call。

4.1.3. SLPBoolean
4.1.3. 斯尔伯伦
4.1.3.1. Synopsis
4.1.3.1. 提要
   typedef enum {
      SLP_FALSE = 0,
      SLP_TRUE = 1
        
   typedef enum {
      SLP_FALSE = 0,
      SLP_TRUE = 1
        

} SLPBoolean;

}SLPBoolean;

4.1.3.2. Description
4.1.3.2. 描述

The SLPBoolean enum is used as a boolean flag.

SLPBoolean枚举用作布尔标志。

4.2. Struct Types
4.2. 结构类型
4.2.1. SLPSrvURL
4.2.1. SLPSrvURL
4.2.1.1. Synopsis
4.2.1.1. 提要
   typedef struct srvurl {
     char *s_pcSrvType;
     char *s_pcHost;
     int   s_iPort;
     char *s_pcNetFamily;
     char *s_pcSrvPart;
   } SLPSrvURL;
        
   typedef struct srvurl {
     char *s_pcSrvType;
     char *s_pcHost;
     int   s_iPort;
     char *s_pcNetFamily;
     char *s_pcSrvPart;
   } SLPSrvURL;
        
4.2.1.2. Description
4.2.1.2. 描述

The SLPSrvURL structure is filled in by the SLPParseSrvURL() function with information parsed from a character buffer containing a service URL. The fields correspond to different parts of the URL. Note that the structure is in conformance with the standard Berkeley sockets struct servent, with the exception that the pointer to an array of characters for aliases (s_aliases field) is replaced by the pointer to host name (s_pcHost field).

SLPSrvURL结构由SLPParseSrvURL()函数填充,其中包含从包含服务URL的字符缓冲区解析的信息。这些字段对应于URL的不同部分。请注意,该结构符合标准的Berkeley sockets struct servent,但指向别名字符数组(s_Alias字段)的指针替换为指向主机名(s_pcHost字段)的指针除外。

s_pcSrvType

s_pcSrvType

A pointer to a character string containing the service type name, including naming authority. The service type name includes the "service:" if the URL is of the service: scheme. [7]

指向包含服务类型名称(包括命名机构)的字符串的指针。如果URL是service:scheme的URL,则服务类型名称包括“service:”。[7]

s_pcHost

s_pcHost

A pointer to a character string containing the host identification information.

指向包含主机标识信息的字符串的指针。

s_iPort

苏伊波特

The port number, or zero if none. The port is only available if the transport is IP.

端口号,如果没有,则为零。该端口仅在传输为IP时可用。

s_pcNetFamily

s_pcNetFamily

A pointer to a character string containing the network address family identifier. Possible values are "ipx" for the IPX family, "at" for the Appletalk family, and "" (i.e. the empty string) for the IP address family.

指向包含网络地址族标识符的字符串的指针。对于ipx系列,可能的值为“ipx”,对于Appletalk系列,可能的值为“at”,对于IP地址系列,可能的值为“”(即空字符串)。

s_pcSrvPart

s_pcSrvPart

The remainder of the URL, after the host identification.

主机标识后URL的其余部分。

The host and port should be sufficient to open a socket to the machine hosting the service, and the remainder of the URL should allow further differentiation of the service.

主机和端口应足以打开托管服务的计算机的套接字,URL的其余部分应允许进一步区分服务。

4.2.2. SLPHandle
4.2.2. 斯莱芬德尔
4.2.2.1. Synopsis
4.2.2.1. 提要

typedef void* SLPHandle;

typedef void*SLPHandle;

The SLPHandle type is returned by SLPOpen() and is a parameter to all SLP functions. It serves as a handle for all resources allocated on behalf of the process by the SLP library. The type is opaque, since the exact nature differs depending on the implementation.

SLPHandle类型由SLPOpen()返回,是所有SLP函数的参数。它充当SLP库代表流程分配的所有资源的句柄。该类型是不透明的,因为具体性质因实现而异。

4.3. Callbacks
4.3. 回调

A function pointer to a callback function specific to a particular API operation is included in the parameter list when the API function is invoked. The callback function is called with the results of the operation in both the synchronous and asynchronous cases. The memory included in the callback parameters is owned by the API library, and the client code in the callback must copy out the contents if it wants to maintain the information longer than the duration of the current callback call.

调用API函数时,参数列表中将包含指向特定于特定API操作的回调函数的函数指针。在同步和异步情况下,都会使用操作结果调用回调函数。回调参数中包含的内存归API库所有,如果回调中的客户机代码希望维护的信息长于当前回调调用的持续时间,则必须将内容复制出去。

In addition to parameters for reporting the results of the operation, each callback parameter list contains an error code parameter and a cookie parameter. The error code parameter reports the error status of the ongoing (for asynchronous) or completed (for synchronous) operation. The cookie parameter allows the client code that starts the operation by invoking the API function to pass information down to the callback without using global variables. The callback returns an SLPBoolean to indicate whether the API library should continue processing the operation. If the value returned from the callback is

除了用于报告操作结果的参数外,每个回调参数列表还包含一个错误代码参数和一个cookie参数。error code参数报告正在进行(异步)或已完成(同步)操作的错误状态。cookie参数允许通过调用API函数启动操作的客户机代码将信息向下传递到回调,而不使用全局变量。回调返回一个SLPBoolean,以指示API库是否应继续处理该操作。如果回调返回的值为

SLP_TRUE, asynchronous operations are terminated, synchronous operations ignore the return (since the operation is already complete).

SLP_TRUE,异步操作终止,同步操作忽略返回(因为操作已经完成)。

4.3.1. SLPRegReport
4.3.1. SLPRegReport
4.3.1.1. Synopsis
4.3.1.1. 提要

typedef void SLPRegReport(SLPHandle hSLP, SLPError errCode, void *pvCookie);

typedef void SLPRegReport(SLPHandle hSLP、slperor errCode、void*pvCookie);

4.3.1.2. Description
4.3.1.2. 描述

The SLPRegReport callback type is the type of the callback function to the SLPReg(), SLPDereg(), and SLPDelAttrs() functions.

SLPRegReport回调类型是SLPReg()、SLPDereg()和SLPDelAttrs()函数的回调函数类型。

4.3.1.3. Parameters
4.3.1.3. 参数

hSLP

hSLP

The SLPHandle used to initiate the operation.

用于启动操作的SLP文件。

errCode

错误代码

An error code indicating if an error occurred during the operation.

指示操作期间是否发生错误的错误代码。

pvCookie

pvCookie

Memory passed down from the client code that called the original API function, starting the operation. May be NULL.

从调用原始API函数的客户机代码传递下来的内存,启动操作。可能为空。

4.3.2. SLPSrvTypeCallback
4.3.2. SLPSrvTypeCallback
4.3.2.1. Synopsis
4.3.2.1. 提要

typedef SLPBoolean SLPSrvTypeCallback(SLPHandle hSLP, const char* pcSrvTypes, SLPError errCode, void *pvCookie);

typedef SLPBoolean SLPSrvTypeCallback(SLPHandle hSLP,const char*pcSrvTypes,slperor errCode,void*pvCookie);

4.3.2.2. Description
4.3.2.2. 描述

The SLPSrvTypeCallback type is the type of the callback function parameter to SLPFindSrvTypes() function. If the hSLP handle parameter was opened asynchronously, the results returned through the callback MAY be uncollated. If the hSLP handle parameter was opened synchronously, then the returned results must be collated and duplicates eliminated.

SLPSrvTypeCallback类型是SLPFindSrvTypes()函数的回调函数参数的类型。如果hSLP handle参数是异步打开的,则通过回调返回的结果可能是非耦合的。如果同步打开hSLP handle参数,则必须整理返回的结果并消除重复项。

4.3.2.3. Parameters
4.3.2.3. 参数

hSLP

hSLP

The SLPHandle used to initiate the operation.

用于启动操作的SLP文件。

pcSrvTypes

PCSRV类型

A character buffer containing a comma separated, null terminated list of service types.

一种字符缓冲区,包含以逗号分隔、以null结尾的服务类型列表。

errCode

错误代码

An error code indicating if an error occurred during the operation. The callback should check this error code before processing the parameters. If the error code is other than SLP_OK, then the API library may choose to terminate the outstanding operation.

指示操作期间是否发生错误的错误代码。回调函数应在处理参数之前检查此错误代码。如果错误代码不是SLP_OK,则API库可以选择终止未完成的操作。

pvCookie

pvCookie

Memory passed down from the client code that called the original API function, starting the operation. May be NULL.

从调用原始API函数的客户机代码传递下来的内存,启动操作。可能为空。

4.3.2.4. Returns
4.3.2.4. 退换商品

The client code should return SLP_TRUE if more data is desired, otherwise SLP_FALSE.

如果需要更多数据,客户端代码应返回SLP_TRUE,否则返回SLP_FALSE。

4.3.3. SLPSrvURLCallback
4.3.3. SLPSrvURLCallback
4.3.3.1. Synopsis
4.3.3.1. 提要

typedef SLPBoolean SLPSrvURLCallback(SLPHandle hSLP, const char* pcSrvURL, unsigned short sLifetime, SLPError errCode, void *pvCookie);

typedef SLPBoolean SLPSrvURLCallback(SLPHandle hSLP、const char*pcSrvURL、无符号短sLifetime、slperor errCode、void*pvCookie);

4.3.3.2. Description
4.3.3.2. 描述

The SLPSrvURLCallback type is the type of the callback function parameter to SLPFindSrvs() function. If the hSLP handle parameter was opened asynchronously, the results returned through the callback MAY be uncollated. If the hSLP handle parameter was opened synchronously, then the returned results must be collated and duplicates eliminated.

SLPSrvURLCallback类型是SLPFindSrvs()函数的回调函数参数的类型。如果hSLP handle参数是异步打开的,则通过回调返回的结果可能是非耦合的。如果同步打开hSLP handle参数,则必须整理返回的结果并消除重复项。

4.3.3.3. Parameters
4.3.3.3. 参数

hSLP

hSLP

The SLPHandle used to initiate the operation.

用于启动操作的SLP文件。

pcSrvURL

pcSrvURL

A character buffer containing the returned service URL.

包含返回的服务URL的字符缓冲区。

sLifetime

滑动时间

An unsigned short giving the life time of the service advertisement, in seconds. The value must be an unsigned integer less than or equal to SLP_LIFETIME_MAXIMUM.

给出服务广告有效期的未签名短片,以秒为单位。该值必须是小于或等于SLP_LIFETIME_MAXIMUM的无符号整数。

errCode

错误代码

An error code indicating if an error occurred during the operation. The callback should check this error code before processing the parameters. If the error code is other than SLP_OK, then the API library may choose to terminate the outstanding operation.

指示操作期间是否发生错误的错误代码。回调函数应在处理参数之前检查此错误代码。如果错误代码不是SLP_OK,则API库可以选择终止未完成的操作。

pvCookie

pvCookie

Memory passed down from the client code that called the original API function, starting the operation. May be NULL.

从调用原始API函数的客户机代码传递下来的内存,启动操作。可能为空。

4.3.3.4. Returns
4.3.3.4. 退换商品

The client code should return SLP_TRUE if more data is desired, otherwise SLP_FALSE.

如果需要更多数据,客户端代码应返回SLP_TRUE,否则返回SLP_FALSE。

4.3.4. SLPAttrCallback
4.3.4. 斯帕特卡尔巴克
4.3.4.1. Synopsis
4.3.4.1. 提要

typedef SLPBoolean SLPAttrCallback(SLPHandle hSLP, const char* pcAttrList, SLPError errCode, void *pvCookie);

typedef SLPBoolean SLPAttrCallback(SLPHandle hSLP、const char*pcAttrList、slperor errCode、void*pvCookie);

4.3.4.2. Description
4.3.4.2. 描述

The SLPAttrCallback type is the type of the callback function parameter to SLPFindAttrs() function.

SLPAttrCallback类型是SLPFindAttrs()函数的回调函数参数类型。

The behavior of the callback differs depending on whether the attribute request was by URL or by service type. If the SLPFindAttrs() operation was originally called with a URL, the callback is called once regardless of whether the handle was opened asynchronously or synchronously. The pcAttrList parameter contains the requested attributes as a comma separated list (or is empty if no attributes matched the original tag list).

回调的行为因属性请求是按URL还是按服务类型而不同。如果最初使用URL调用SLPFindAttrs()操作,则无论句柄是异步打开还是同步打开,都会调用一次回调。pcAttrList参数以逗号分隔的列表形式包含请求的属性(如果没有与原始标记列表匹配的属性,则为空)。

If the SLPFindAttrs() operation was originally called with a service type, the value of pcAttrList and calling behavior depend on whether the handle was opened asynchronously or synchronously. If the handle was opened asynchronously, the callback is called every time the API library has results from a remote agent. The pcAttrList parameter MAY be uncollated between calls. It contains a comma separated list with the results from the agent that immediately returned results. If the handle was opened synchronously, the results must be collated from all returning agents and the callback is called once, with the pcAttrList parameter set to the collated result.

如果最初使用服务类型调用SLPFindAttrs()操作,则pcAttrList的值和调用行为取决于句柄是异步打开还是同步打开。如果句柄是异步打开的,则每次API库从远程代理获得结果时都会调用回调。pcAttrList参数在调用之间可以不耦合。它包含一个逗号分隔的列表,其中包含立即返回结果的代理的结果。如果句柄是同步打开的,则必须从所有返回的代理中整理结果,并调用回调一次,将pcAttrList参数设置为整理的结果。

4.3.4.3. Parameters
4.3.4.3. 参数

hSLP

hSLP

The SLPHandle used to initiate the operation.

用于启动操作的SLP文件。

pcAttrList

pcAttrList

A character buffer containing a comma separated, null terminated list of attribute id/value assignments, in SLP wire format; i.e. "(attr-id=attr-value-list)" [7].

字符缓冲区,包含以逗号分隔、以null结尾的属性id/值分配列表,采用SLP wire格式;i、 e.“(属性id=属性值列表)”[7]。

errCode

错误代码

An error code indicating if an error occurred during the operation. The callback should check this error code before processing the parameters. If the error code is other than SLP_OK, then the API library may choose to terminate the outstanding operation.

指示操作期间是否发生错误的错误代码。回调函数应在处理参数之前检查此错误代码。如果错误代码不是SLP_OK,则API库可以选择终止未完成的操作。

pvCookie

pvCookie

Memory passed down from the client code that called the original API function, starting the operation. May be NULL.

从调用原始API函数的客户机代码传递下来的内存,启动操作。可能为空。

4.3.4.4. Returns
4.3.4.4. 退换商品

The client code should return SLP_TRUE if more data is desired, otherwise SLP_FALSE.

如果需要更多数据,客户端代码应返回SLP_TRUE,否则返回SLP_FALSE。

4.4. Opening and Closing an SLPHandle
4.4. 打开和关闭SLPHandle
4.4.1. SLPOpen
4.4.1. 斯波本
4.4.1.1. Synopsis
4.4.1.1. 提要
   SLPError SLPOpen(const char *pcLang, SLPBoolean isAsync, SLPHandle
   *phSLP);
        
   SLPError SLPOpen(const char *pcLang, SLPBoolean isAsync, SLPHandle
   *phSLP);
        
4.4.1.2. Description
4.4.1.2. 描述

Returns a SLPHandle handle in the phSLP parameter for the language locale passed in as the pcLang parameter. The client indicates if operations on the handle are to be synchronous or asynchronous through the isAsync parameter. The handle encapsulates the language locale for SLP requests issued through the handle, and any other resources required by the implementation. However, SLP properties are not encapsulated by the handle; they are global. The return value of the function is an SLPError code indicating the status of the operation. Upon failure, the phSLP parameter is NULL.

返回作为pcLang参数传入的语言区域设置的phSLP参数中的SLPHandle句柄。客户端通过isAsync参数指示句柄上的操作是同步的还是异步的。句柄封装了通过句柄发出的SLP请求的语言环境,以及实现所需的任何其他资源。但是,SLP属性不是由句柄封装的;它们是全球性的。函数的返回值是指示操作状态的SLPEROR代码。失败时,phSLP参数为空。

An SLPHandle can only be used for one SLP API operation at a time. If the original operation was started asynchronously, any attempt to start an additional operation on the handle while the original operation is pending results in the return of an SLP_HANDLE_IN_USE error from the API function. The SLPClose() API function terminates any outstanding calls on the handle. If an implementation is unable to support a asynchronous( resp. synchronous) operation, due to memory constraints or lack of threading support, the SLP_NOT_IMPLEMENTED flag may be returned when the isAsync flag is

一个SLPHandle一次只能用于一个SLP API操作。如果原始操作是异步启动的,则在原始操作挂起时尝试在句柄上启动其他操作将导致API函数返回SLP_handle_in_USE错误。SLPClose()API函数终止句柄上任何未完成的调用。如果由于内存限制或缺少线程支持,实现无法支持异步(分别为同步)操作,则在启用isAsync标志时,可能会返回SLP_NOT_IMPLEMENTED标志

SLP_TRUE (resp. SLP_FALSE).

SLP_为真(分别为SLP_为假)。

4.4.1.3. Parameters
4.4.1.3. 参数

pcLang

普朗

A pointer to an array of characters containing the RFC 1766 Language Tag [6] for the natural language locale of requests and registrations issued on the handle.

指向包含RFC 1766语言标记[6]的字符数组的指针,用于句柄上发出的请求和注册的自然语言环境。

isAsync

isAsync

An SLPBoolean indicating whether the SLPHandle should be opened for asynchronous operation or not.

一个SLPBoolean,指示是否应为异步操作打开SLPHandle。

phSLP

phSLP

A pointer to an SLPHandle, in which the open SLPHandle is returned. If an error occurs, the value upon return is NULL.

指向SLPHandle的指针,其中返回打开的SLPHandle。如果发生错误,则返回时的值为NULL。

4.4.2. SLPClose
4.4.2. SLPClose
4.4.2.1. Synopsis
4.4.2.1. 提要

void SLPClose(SLPHandle hSLP);

无效SLPClose(SLPHandle hSLP);

4.4.2.2. Description
4.4.2.2. 描述

Frees all resources associated with the handle. If the handle was invalid, the function returns silently. Any outstanding synchronous or asynchronous operations are cancelled so their callback functions will not be called any further.

释放与句柄关联的所有资源。如果句柄无效,则函数以静默方式返回。任何未完成的同步或异步操作都将被取消,因此它们的回调函数将不再被调用。

4.4.2.3. Parameters
4.4.2.3. 参数

SLPHandle

斯莱芬德尔

A SLPHandle handle returned from a call to SLPOpen().

从调用SLPOpen()返回的SLPHandle句柄。

4.5. Protocol API
4.5. 协议API
4.5.1. SLPReg
4.5.1. SLPReg
4.5.1.1. Synopsis
4.5.1.1. 提要

SLPError SLPReg(SLPHandle hSLP, const char *pcSrvURL, const unsigned short usLifetime, const char *pcSrvType, const char *pcAttrs SLPBoolean fresh, SLPRegReport callback, void *pvCookie);

slperor SLPReg(SLPHandle hSLP、const char*pcSrvURL、const unsigned short uslife、const char*pcSrvType、const char*pcAttrs SLPBoolean fresh、SLPRegReport回调、void*pvCookie);

4.5.1.2. Description
4.5.1.2. 描述

Registers the URL in pcSrvURL having the lifetime usLifetime with the attribute list in pcAttrs. The pcAttrs list is a comma separated list of attribute assignments in the wire format (including escaping of reserved characters). The usLifetime parameter must be nonzero and less than or equal to SLP_LIFETIME_MAXIMUM. If the fresh flag is SLP_TRUE, then the registration is new (the SLP protocol FRESH flag is set) and the registration replaces any existing registrations. The pcSrvType parameter is a service type name and can be included for service URLs that are not in the service: scheme. If the URL is in the service: scheme, the pcSrvType parameter is ignored. If the fresh flag is SLP_FALSE, then an existing registration is updated. Rules for new and updated registrations, and the format for pcAttrs and pcScopeList can be found in [7]. Registrations and updates take place in the language locale of the hSLP handle.

将pcSrvURL中具有生存期USLIFET的URL注册到PCATTR中的属性列表中。pcAttrs列表是以逗号分隔的wire格式的属性指定列表(包括保留字符的转义)。USLIFET参数必须为非零且小于或等于SLP_LIFET_最大值。如果fresh标志为SLP_TRUE,则注册是新的(设置了SLP协议fresh标志),并且注册将替换任何现有注册。pcSrvType参数是一个服务类型名称,可以包含在不在service:scheme中的服务URL中。如果URL位于service:scheme中,则忽略pcSrvType参数。如果fresh标志为SLP_FALSE,则更新现有注册。有关新注册和更新注册的规则,以及pcAttrs和pcScopeList的格式,请参见[7]。注册和更新在hSLP句柄的语言环境中进行。

The API library is required to perform the operation in all scopes obtained through configuration.

API库需要在通过配置获得的所有作用域中执行操作。

4.5.1.3. Parameters
4.5.1.3. 参数

hSLP

hSLP

The language specific SLPHandle on which to register the advertisement.

要在其上注册广告的特定于语言的图片。

pcSrvURL

pcSrvURL

The URL to register. May not be the empty string.

要注册的URL。可能不是空字符串。

usLifetime

使用寿命

An unsigned short giving the life time of the service advertisement, in seconds. The value must be an unsigned integer less than or equal to SLP_LIFETIME_MAXIMUM and greater than zero.

给出服务广告有效期的未签名短片,以秒为单位。该值必须是小于或等于SLP_LIFETIME_MAXIMUM且大于零的无符号整数。

pcSrvType

PCSRV类型

The service type. If pURL is a service: URL, then this parameter is ignored.

服务类型。如果pURL是一个service:URL,则忽略此参数。

pcAttrs

pcAttrs

A comma separated list of attribute assignment expressions for the attributes of the advertisement. Use empty string, "" for no attributes.

播发属性的属性分配表达式的逗号分隔列表。对于无属性,请使用空字符串“”。

fresh

新鲜的

An SLPBoolean that is SLP_TRUE if the registration is new or SLP_FALSE if a reregistration.

如果注册是新的,则为SLP_TRUE;如果重新注册,则为SLP_FALSE。

callback

回拨

A callback to report the operation completion status.

用于报告操作完成状态的回调。

pvCookie

pvCookie

Memory passed to the callback code from the client. May be NULL.

从客户端传递给回调代码的内存。可能为空。

4.5.1.4. Returns
4.5.1.4. 退换商品

If an error occurs in starting the operation, one of the SLPError codes is returned.

如果启动操作时发生错误,则返回一个SLPEROR代码。

4.5.2. SLPDereg
4.5.2. 斯普德雷格
4.5.2.1. Synopsis
4.5.2.1. 提要

SLPError SLPDereg(SLPHandle hSLP, const char *pcURL, SLPRegReport callback, void *pvCookie);

slperor SLPDereg(SLPHandle hSLP、const char*pcURL、slpregrept回调、void*pvCookie);

4.5.2.2. Description
4.5.2.2. 描述

Deregisters the advertisement for URL pcURL in all scopes where the service is registered and all language locales. The deregistration is not just confined to the locale of the SLPHandle, it is in all locales. The API library is required to perform the operation in all scopes obtained through configuration.

在注册服务的所有作用域和所有语言环境中取消注册URL pcURL的播发。撤销注册不仅限于SLPHandle的地区,还包括所有地区。API库需要在通过配置获得的所有作用域中执行操作。

4.5.2.3. Parameters
4.5.2.3. 参数

hSLP

hSLP

The language specific SLPHandle to use for deregistering.

用于注销的特定于语言的SLPHandle。

pcURL

pcURL

The URL to deregister. May not be the empty string.

要取消注册的URL。可能不是空字符串。

callback

回拨

A callback to report the operation completion status.

用于报告操作完成状态的回调。

pvCookie

pvCookie

Memory passed to the callback code from the client. May be NULL.

从客户端传递给回调代码的内存。可能为空。

4.5.2.4. Returns
4.5.2.4. 退换商品

If an error occurs in starting the operation, one of the SLPError codes is returned.

如果启动操作时发生错误,则返回一个SLPEROR代码。

4.5.3. SLPDelAttrs
4.5.3. SLPDelAttrs
4.5.3.1. Synopsis
4.5.3.1. 提要

SLPError SLPDelAttrs(SLPHandle hSLP, const char *pcURL, const char *pcAttrs, SLPRegReport callback, void *pvCookie);

slperor slpdelatetrs(SLPHandle hSLP、const char*pcURL、const char*pcAttrs、SLPRegReport回调、void*pvCookie);

4.5.3.2. Description
4.5.3.2. 描述

Delete the selected attributes in the locale of the SLPHandle. The API library is required to perform the operation in all scopes obtained through configuration.

删除SLPHandle区域设置中的选定属性。API库需要在通过配置获得的所有作用域中执行操作。

4.5.3.3. Parameters
4.5.3.3. 参数

hSLP

hSLP

The language specific SLPHandle to use for deleting attributes.

用于删除属性的特定于语言的SLPHandle。

pcURL

pcURL

The URL of the advertisement from which the attributes should be deleted. May not be the empty string.

应从中删除属性的播发的URL。可能不是空字符串。

pcAttrs

pcAttrs

A comma separated list of attribute ids for the attributes to deregister. See Section 9.8 in [7] for a description of the list format. May not be the empty string.

要注销的属性的属性ID的逗号分隔列表。有关列表格式的说明,请参见[7]中的第9.8节。可能不是空字符串。

callback

回拨

A callback to report the operation completion status.

用于报告操作完成状态的回调。

pvCookie

pvCookie

Memory passed to the callback code from the client. May be NULL.

从客户端传递给回调代码的内存。可能为空。

4.5.3.4. Returns
4.5.3.4. 退换商品

If an error occurs in starting the operation, one of the SLPError codes is returned.

如果启动操作时发生错误,则返回一个SLPEROR代码。

4.5.4. SLPFindSrvTypes
4.5.4. SLPFindSrvTypes
4.5.4.1. Synopsis
4.5.4.1. 提要

SLPError SLPFindSrvTypes(SLPHandle hSLP, const char *pcNamingAuthority, const char *pcScopeList, SLPSrvTypeCallback callback, void *pvCookie);

slperor SLPFindSrvTypes(SLPHandle hSLP、const char*pcnamigauthority、const char*pcScopeList、SLPSrvTypeCallback回调、void*pvCookie);

The SLPFindSrvType() function issues an SLP service type request for service types in the scopes indicated by the pcScopeList. The results are returned through the callback parameter. The service types are independent of language locale, but only for services registered in one of scopes and for the indicated naming authority.

函数的作用域为pcScopeList指示的作用域中的服务类型发出SLP服务类型请求。结果通过回调参数返回。服务类型独立于语言区域设置,但仅适用于在其中一个作用域中注册的服务和指定的命名机构。

If the naming authority is "*", then results are returned for all naming authorities. If the naming authority is the empty string, i.e. "", then the default naming authority, "IANA", is used. "IANA" is not a valid naming authority name, and it is a PARAMETER_BAD error to include it explicitly.

如果命名机构为“*”,则返回所有命名机构的结果。如果命名机构为空字符串,即“”,则使用默认命名机构“IANA”。“IANA”不是有效的命名机构名称,显式包含它是一个参数错误。

The service type names are returned with the naming authority intact. If the naming authority is the default (i.e. empty string) then it is omitted, as is the separating ".". Service type names from URLs of the service: scheme are returned with the "service:" prefix intact. [7] See [8] for more information on the syntax of service type names.

返回服务类型名称时,命名权限保持不变。如果命名机构是默认的(即空字符串),那么它将被忽略,因为分隔的“.”。来自Service:scheme的URL的服务类型名称返回时“Service:”前缀保持不变。[7] 有关服务类型名称语法的更多信息,请参见[8]。

4.5.4.2. Parameters
4.5.4.2. 参数

hSLP

hSLP

The SLPHandle on which to search for types.

要在其上搜索类型的SLPHandle。

pcNamingAuthority

授权

The naming authority to search. Use "*" for all naming authorities and the empty string, "", for the default naming authority.

要搜索的命名权限。所有命名机构使用“*”,默认命名机构使用空字符串“”。

pcScopeList

pcScopeList

A pointer to a char containing comma separated list of scope names to search for service types. May not be the empty string, "".

指向包含逗号分隔的作用域名称列表的字符的指针,用于搜索服务类型。不能是空字符串“”。

callback

回拨

A callback function through which the results of the operation are reported.

用于报告操作结果的回调函数。

pvCookie

pvCookie

Memory passed to the callback code from the client. May be NULL.

从客户端传递给回调代码的内存。可能为空。

4.5.4.3. Returns
4.5.4.3. 退换商品

If an error occurs in starting the operation, one of the SLPError codes is returned.

如果启动操作时发生错误,则返回一个SLPEROR代码。

4.5.5. SLPFindSrvs
4.5.5. SLPFINDSRV
4.5.5.1. Synopsis
4.5.5.1. 提要

SLPError SLPFindSrvs(SLPHandle hSLP, const char *pcServiceType, const char *pcScopeList, const char *pcSearchFilter, SLPSrvURLCallback callback, void *pvCookie);

slperor SLPFindSrvs(SLPHandle hSLP、const char*pcServiceType、const char*pcScopeList、const char*pcSearchFilter、SLPSrvURLCallback回调、void*pvCookie);

4.5.5.2. Description
4.5.5.2. 描述

Issue the query for services on the language specific SLPHandle and return the results through the callback. The parameters determine the results

在特定于语言的SLPHandle上发出服务查询,并通过回调返回结果。这些参数决定了结果

4.5.5.3. Parameters
4.5.5.3. 参数

hSLP

hSLP

The language specific SLPHandle on which to search for services.

要在其上搜索服务的特定于语言的SLPHandle。

pcServiceType

pcServiceType

The Service Type String, including authority string if any, for the request, such as can be discovered using SLPSrvTypes(). This could be, for example "service:printer:lpr" or "service:nfs". May not be the empty string.

请求的服务类型字符串,包括权限字符串(如果有),例如可以使用SLPSrvTypes()查找。例如,这可能是“服务:打印机:lpr”或“服务:nfs”。可能不是空字符串。

pcScopeList

pcScopeList

A pointer to a char containing comma separated list of scope names. May not be the empty string, "".

指向包含逗号分隔的作用域名称列表的字符的指针。不能是空字符串“”。

pcSearchFilter

pcSearchFilter

A query formulated of attribute pattern matching expressions in the form of a LDAPv3 Search Filter, see [4]. If this filter is empty, i.e. "", all services of the requested type in the

以LDAPv3搜索过滤器形式表示的属性模式匹配表达式的查询,请参见[4]。如果此筛选器为空,即“”,则

specified scopes are returned.

返回指定的作用域。

callback

回拨

A callback function through which the results of the operation are reported.

用于报告操作结果的回调函数。

pvCookie

pvCookie

Memory passed to the callback code from the client. May be NULL.

从客户端传递给回调代码的内存。可能为空。

4.5.5.4. Returns
4.5.5.4. 退换商品

If an error occurs in starting the operation, one of the SLPError codes is returned.

如果启动操作时发生错误,则返回一个SLPEROR代码。

4.5.6. SLPFindAttrs
4.5.6. SLPFindAttrs
4.5.6.1. Synopsis
4.5.6.1. 提要

SLPError SLPFindAttrs(SLPHandle hSLP, const char *pcURLOrServiceType, const char *pcScopeList, const char *pcAttrIds, SLPAttrCallback callback, void *pvCookie);

slperor SLPFindAttrs(SLPHandle hSLP、const char*pcurlorservice type、const char*pcScopeList、const char*pcAttrIds、SLPAttrCallback回调、void*pvCookie);

4.5.6.2. Description
4.5.6.2. 描述

This function returns service attributes matching the attribute ids for the indicated service URL or service type. If pcURLOrServiceType is a service URL, the attribute information returned is for that particular advertisement in the language locale of the SLPHandle.

此函数返回与指定服务URL或服务类型的属性ID匹配的服务属性。如果pcURLOrServiceType是服务URL,则返回的属性信息是针对SLPHandle语言环境中的特定广告的。

If pcURLOrServiceType is a service type name (including naming authority if any), then the attributes for all advertisements of that service type are returned regardless of the language of registration. Results are returned through the callback.

如果pcURLOrServiceType是服务类型名称(包括命名机构(如果有)),则返回该服务类型的所有播发的属性,而不考虑注册语言。结果通过回调返回。

The result is filtered with an SLP attribute request filter string parameter, the syntax of which is described in [7]. If the filter string is the empty string, i.e. "", all attributes are returned.

使用SLP属性请求过滤器字符串参数过滤结果,其语法如[7]所述。如果筛选器字符串为空字符串,即“”,则返回所有属性。

4.5.6.3. Parameters
4.5.6.3. 参数

hSLP

hSLP

The language specific SLPHandle on which to search for attributes.

要在其上搜索属性的特定于语言的SLPHandle。

pcURLOrServiceType

pcURLOrServiceType

The service URL or service type. See [7] for URL and service type syntax. May not be the empty string.

服务URL或服务类型。有关URL和服务类型语法,请参见[7]。可能不是空字符串。

pcScopeList

pcScopeList

A pointer to a char containing a comma separated list of scope names. May not be the empty string, "".

指向包含逗号分隔的作用域名称列表的字符的指针。不能是空字符串“”。

pcAttrIds

pcAttrIds

The filter string indicating which attribute values to return. Use empty string, "", to indicate all values. Wildcards matching all attribute ids having a particular prefix or suffix are also possible. See [7] for the exact format of the filter string.

指示要返回哪些属性值的筛选器字符串。使用空字符串“”,以指示所有值。也可以使用与具有特定前缀或后缀的所有属性ID匹配的通配符。有关筛选器字符串的确切格式,请参见[7]。

callback

回拨

A callback function through which the results of the operation are reported.

用于报告操作结果的回调函数。

pvCookie

pvCookie

Memory passed to the callback code from the client. May be NULL.

从客户端传递给回调代码的内存。可能为空。

4.5.6.4. Returns
4.5.6.4. 退换商品

If an error occurs in starting the operation, one of the SLPError codes is returned.

如果启动操作时发生错误,则返回一个SLPEROR代码。

4.6. Miscellaneous Functions
4.6. 其他函数
4.6.1. SLPGetRefreshInterval
4.6.1. SLPGetRefreshInterval
4.6.1.1. Synopsis
4.6.1.1. 提要

unsigned short SLPGetRefreshInterval();

无符号短SLPGetRefreshInterval();

4.6.1.2. Description
4.6.1.2. 描述

Returns the maximum across all DAs of the min-refresh-interval attribute. This value satisfies the advertised refresh interval bounds for all DAs, and, if used by the SA, assures that no refresh registration will be rejected. If no DA advertises a min-refresh-interval attribute, a value of 0 is returned.

返回“最小刷新间隔”属性的所有DA的最大值。该值满足所有DA的公布刷新间隔界限,并且如果SA使用该值,则确保不会拒绝任何刷新注册。如果没有DA播发最小刷新间隔属性,则返回值0。

4.6.1.3. Returns
4.6.1.3. 退换商品

If no error, the maximum refresh interval value allowed by all DAs (a positive integer). If no DA advertises a min-refresh-interval attribute, returns 0. If an error occurs, returns an SLP error code.

如果没有错误,则为所有DAs允许的最大刷新间隔值(正整数)。如果没有DA播发最小刷新间隔属性,则返回0。如果发生错误,则返回SLP错误代码。

4.6.2. SLPFindScopes
4.6.2. SLP内窥镜
4.6.2.1. Synopsis
4.6.2.1. 提要
   SLPError SLPFindScopes(SLPHandle hSLP,
                          char** ppcScopeList);
        
   SLPError SLPFindScopes(SLPHandle hSLP,
                          char** ppcScopeList);
        
4.6.2.2. Description
4.6.2.2. 描述

Sets ppcScopeList parameter to a pointer to a comma separated list including all available scope values. The list of scopes comes from a variety of sources: the configuration file's net.slp.useScopes property, unicast to DAs on the net.slp.DAAddresses property, DHCP, or through the DA discovery process. If there is any order to the scopes, preferred scopes are listed before less desirable scopes. There is always at least one name in the list, the default scope, "DEFAULT".

将ppcScopeList参数设置为指向包含所有可用范围值的逗号分隔列表的指针。作用域列表来自多种来源:配置文件的net.slp.useScopes属性、net.slp.DAAddresses属性上的DAs单播、DHCP或通过DA发现过程。如果作用域有任何顺序,首选作用域将列在不太理想的作用域之前。列表中始终至少有一个名称,即默认范围“default”。

4.6.2.3. Parameters
4.6.2.3. 参数

hSLP

hSLP

The SLPHandle on which to search for scopes.

要在其上搜索作用域的SLPHandle。

ppcScopeList

ppcScopeList

A pointer to char pointer into which the buffer pointer is placed upon return. The buffer is null terminated. The memory should be freed by calling SLPFree().

一种指向char指针的指针,返回时缓冲区指针被放入该指针中。缓冲区以null结尾。应通过调用SLPFree()释放内存。

4.6.2.4. Returns
4.6.2.4. 退换商品

If no error occurs, returns SLP_OK, otherwise, the appropriate error code.

如果未发生错误,则返回SLP_OK,否则返回相应的错误代码。

4.6.3. SLPParseSrvURL
4.6.3. SLPPARSERVURL
4.6.3.1. Synopsis
4.6.3.1. 提要
   SLPError SLPParseSrvURL(char *pcSrvURL
                           SLPSrvURL** ppSrvURL);
        
   SLPError SLPParseSrvURL(char *pcSrvURL
                           SLPSrvURL** ppSrvURL);
        
4.6.3.2. Description
4.6.3.2. 描述

Parses the URL passed in as the argument into a service URL structure and returns it in the ppSrvURL pointer. If a parse error occurs, returns SLP_PARSE_ERROR. The input buffer pcSrvURL is destructively modified during the parse and used to fill in the fields of the return structure. The structure returned in ppSrvURL should be freed with SLPFreeURL(). If the URL has no service part, the s_pcSrvPart string is the empty string, "", i.e. not NULL. If pcSrvURL is not a service: URL, then the s_pcSrvType field in the returned data structure is the URL's scheme, which might not be the same as the service type under which the URL was registered. If the transport is IP, the s_pcTransport field is the empty string. If the transport is not IP or there is no port number, the s_iPort field is zero.

将作为参数传入的URL解析为服务URL结构,并在ppSrvURL指针中返回它。如果发生解析错误,则返回SLP_parse_error。在解析过程中,输入缓冲区pcSrvURL被破坏性地修改,并用于填充返回结构的字段。ppSrvURL中返回的结构应使用SLPFreeURL()释放。如果URL没有服务部件,则s_pcSrvPart字符串为空字符串“”,即不为空。如果pcSrvURL不是service:URL,则返回的数据结构中的s_pcSrvType字段是URL的方案,该方案可能与注册URL的服务类型不同。如果传输为IP,则s_pcTransport字段为空字符串。如果传输不是IP或没有端口号,则s_iPort字段为零。

4.6.3.3. Parameters
4.6.3.3. 参数

pcSrvURL

pcSrvURL

A pointer to a character buffer containing the null terminated URL string to parse. It is destructively modified to produce the output structure.

指向字符缓冲区的指针,其中包含要分析的以null结尾的URL字符串。它被破坏性地修改以产生输出结构。

ppSrvURL

ppSrvURL

A pointer to a pointer for the SLPSrvURL structure to receive the parsed URL. The memory should be freed by a call to SLPFree() when no longer needed.

指向用于SLPSrvURL结构接收解析URL的指针的指针。不再需要时,应通过调用SLPFree()释放内存。

4.6.3.4. Returns
4.6.3.4. 退换商品

If no error occurs, the return value is SLP_OK. Otherwise, the appropriate error code is returned.

如果没有发生错误,则返回值为SLP_OK。否则,将返回相应的错误代码。

4.6.4. SLPEscape
4.6.4. SLPEscape
4.6.4.1. Synopsis
4.6.4.1. 提要
   SLPError SLPEscape(const char* pcInbuf,
                      char** ppcOutBuf,
                      SLPBoolean isTag);
        
   SLPError SLPEscape(const char* pcInbuf,
                      char** ppcOutBuf,
                      SLPBoolean isTag);
        
4.6.4.2. Description
4.6.4.2. 描述

Process the input string in pcInbuf and escape any SLP reserved characters. If the isTag parameter is SLPTrue, then look for bad tag characters and signal an error if any are found by returning the SLP_PARSE_ERROR code. The results are put into a buffer allocated by the API library and returned in the ppcOutBuf parameter. This buffer should be deallocated using SLPFree() when the memory is no longer needed.

处理pcInbuf中的输入字符串并转义任何SLP保留字符。如果isTag参数为SLPTrue,则查找错误的标记字符,并通过返回SLP_PARSE_错误代码发出错误信号(如果发现)。结果被放入API库分配的缓冲区中,并在ppcOutBuf参数中返回。当不再需要内存时,应使用SLPFree()释放此缓冲区。

4.6.4.3. Parameters
4.6.4.3. 参数

pcInbuf

pcInbuf

Pointer to he input buffer to process for escape characters.

指向要处理转义字符的输入缓冲区的指针。

ppcOutBuf

ppcOutBuf

Pointer to a pointer for the output buffer with the SLP reserved characters escaped. Must be freed using SLPFree() when the memory is no longer needed.

指向已转义SLP保留字符的输出缓冲区指针的指针。当不再需要内存时,必须使用SLPFree()释放。

isTag

伊斯塔格

When true, the input buffer is checked for bad tag characters.

如果为true,则检查输入缓冲区中是否存在错误的标记字符。

4.6.4.4. Returns
4.6.4.4. 退换商品

Return SLP_PARSE_ERROR if any characters are bad tag characters and the isTag flag is true, otherwise SLP_OK, or the appropriate error code if another error occurs.

如果任何字符是错误的标记字符且isTag标志为true,则返回SLP_PARSE_ERROR,否则返回SLP_OK,如果发生其他错误,则返回相应的错误代码。

4.6.5. SLPUnescape
4.6.5. 斯普恩逃脱
4.6.5.1. Synopsis
4.6.5.1. 提要
   SLPError SLPUnescape(const char* pcInbuf,
                        char** ppcOutBuf,
                        SLPBoolean isTag);
        
   SLPError SLPUnescape(const char* pcInbuf,
                        char** ppcOutBuf,
                        SLPBoolean isTag);
        
4.6.5.2. Description
4.6.5.2. 描述

Process the input string in pcInbuf and unescape any SLP reserved characters. If the isTag parameter is SLPTrue, then look for bad tag characters and signal an error if any are found with the SLP_PARSE_ERROR code. No transformation is performed if the input string is an opaque. The results are put into a buffer allocated by the API library and returned in the ppcOutBuf parameter. This buffer should be deallocated using SLPFree() when the memory is no longer needed.

处理pcInbuf中的输入字符串,并取消扫描任何SLP保留字符。如果isTag参数为SLPTrue,则查找错误的标记字符,如果发现SLP_PARSE_错误代码有错误,则发出错误信号。如果输入字符串是不透明的,则不执行任何转换。结果被放入API库分配的缓冲区中,并在ppcOutBuf参数中返回。当不再需要内存时,应使用SLPFree()释放此缓冲区。

4.6.5.3. Parameters
4.6.5.3. 参数

pcInbuf

pcInbuf

Pointer to he input buffer to process for escape characters.

指向要处理转义字符的输入缓冲区的指针。

ppcOutBuf

ppcOutBuf

Pointer to a pointer for the output buffer with the SLP reserved characters escaped. Must be freed using SLPFree() when the memory is no longer needed.

指向已转义SLP保留字符的输出缓冲区指针的指针。当不再需要内存时,必须使用SLPFree()释放。

isTag

伊斯塔格

When true, the input buffer is checked for bad tag characters.

如果为true,则检查输入缓冲区中是否存在错误的标记字符。

4.6.5.4. Returns
4.6.5.4. 退换商品

Return SLP_PARSE_ERROR if any characters are bad tag characters and the isTag flag is true, otherwise SLP_OK, or the appropriate error code if another error occurs.

如果任何字符是错误的标记字符且isTag标志为true,则返回SLP_PARSE_ERROR,否则返回SLP_OK,如果发生其他错误,则返回相应的错误代码。

4.6.6. SLPFree
4.6.6. SLPFree
4.6.6.1. Synopsis
4.6.6.1. 提要
      void SLPFree(void* pvMem);
        
      void SLPFree(void* pvMem);
        
4.6.6.2. Description
4.6.6.2. 描述

Frees memory returned from SLPParseSrvURL(), SLPFindScopes(), SLPEscape(), and SLPUnescape().

释放从SLPParseSrvURL()、SLPFindScopes()、SLPEscape()和slpunsecase()返回的内存。

4.6.6.3. Parameters
4.6.6.3. 参数

pvMem

pvMem

A pointer to the storage allocated by the SLPParseSrvURL(), SLPEscape(), SLPUnescape(), or SLPFindScopes() function. Ignored if NULL.

指向由SLPParseSrvURL()、SLPEscape()、slpunsecase()或SLPFindScopes()函数分配的存储的指针。如果为空,则忽略。

4.6.7. SLPGetProperty
4.6.7. SLPGetProperty
4.6.7.1. Synopsis
4.6.7.1. 提要
   const char* SLPGetProperty(const char* pcName);
        
   const char* SLPGetProperty(const char* pcName);
        
4.6.7.2. Description
4.6.7.2. 描述

Returns the value of the corresponding SLP property name. The returned string is owned by the library and MUST NOT be freed.

返回相应SLP属性名称的值。返回的字符串归库所有,不能释放。

4.6.7.3. Parameters
4.6.7.3. 参数

pcName

pcName

Null terminated string with the property name, from Section 2.1.

第2.1节中以Null结尾的属性名字符串。

4.6.7.4. Returns
4.6.7.4. 退换商品

If no error, returns a pointer to a character buffer containing the property value. If the property was not set, returns the default value. If an error occurs, returns NULL. The returned string MUST NOT be freed.

如果没有错误,则返回指向包含属性值的字符缓冲区的指针。如果未设置属性,则返回默认值。如果发生错误,则返回NULL。不能释放返回的字符串。

4.6.8. SLPSetProperty
4.6.8. SLPSetProperty
4.6.8.1. Synopsis
4.6.8.1. 提要
      void SLPSetProperty(const char *pcName,
                          const char *pcValue);
        
      void SLPSetProperty(const char *pcName,
                          const char *pcValue);
        
4.6.8.2. Description
4.6.8.2. 描述

Sets the value of the SLP property to the new value. The pcValue parameter should be the property value as a string.

将SLP属性的值设置为新值。pcValue参数应为字符串形式的属性值。

4.6.8.3. Parameters
4.6.8.3. 参数

pcName

pcName

Null terminated string with the property name, from Section 2.1.

第2.1节中以Null结尾的属性名字符串。

pcValue

pcValue

Null terminated string with the property value, in UTF-8 character encoding.

在UTF-8字符编码中,具有属性值的以Null结尾的字符串。

4.7. Implementation Notes
4.7. 实施说明
4.7.1. Refreshing Registrations
4.7.1. 刷新注册

Clients indicate that they want URLs to be automatically refreshed by setting the usLifetime parameter in the SLPReg() function call to SLP_LIFETIME_MAXIMUM. This will cause the API implementation to refresh the URL before it times out. Although using SLP_LIFETIME_MAXIMUM to designate automatic reregistration means that a transient URL can't be registered for the maximum lifetime, little hardship is likely to occur, since service URL lifetimes are measured in seconds and the client can simply use a lifetime of SLP_LIFETIME_MAXIMUM - 1 if a transient URL near the maximum lifetime is desired. API implementations MUST provide this facility.

客户端通过将SLPReg()函数调用中的uslifety参数设置为SLP_lifety_MAXIMUM,表示希望自动刷新URL。这将导致API实现在URL超时之前刷新URL。虽然使用SLP_liferate_MAXIMUM指定自动重新注册意味着临时URL无法在最长的生存期内注册,但不太可能出现困难,因为服务URL生存期是以秒为单位测量的,如果需要接近最大生存期的临时URL,客户端可以简单地使用SLP_lifety_max-1的生存期。API实现必须提供此功能。

4.7.2. Syntax for String Parameters
4.7.2. 字符串参数的语法

Query strings, attribute registration lists, attribute deregistration lists, scope lists, and attribute selection lists follow the syntax described in [7] for the appropriate requests. The API directly reflects the strings passed in from clients into protocol requests, and directly reflects out strings returned from protocol replies to

查询字符串、属性注册列表、属性注销列表、范围列表和属性选择列表遵循[7]中所述的相应请求语法。API直接将从客户端传入的字符串反映到协议请求中,并直接反映从协议回复返回的字符串

clients. As a consequence, clients are responsible for formatting request strings, including escaping and converting opaque values to escaped byte encoded strings. Similarly, on output, clients are required to unescape strings and convert escaped string encoded opaques to binary. The functions SLPEscape() and SLPUnescape() can be used for escaping SLP reserved characters, but perform no opaque processing.

客户。因此,客户端负责格式化请求字符串,包括转义和将不透明值转换为转义字节编码字符串。类似地,在输出时,客户机需要取消对字符串的扫描,并将转义字符串编码的不透明转换为二进制。函数SLPEscape()和slpunsecase()可用于转义SLP保留字符,但不执行不透明处理。

Opaque values consist of a character buffer containing a UTF-8- encoded string, the first characters of which are the nonUTF-8 encoding '\ff'. Subsequent characters are the escaped values for the original bytes in the opaque. The escape convention is relatively simple. An escape consists of a backslash followed by the two hexadecimal digits encoding the byte. An example is '\2c' for the byte 0x2c. Clients handle opaque processing themselves, since the algorithm is relatively simple and uniform.

不透明值由包含UTF-8编码字符串的字符缓冲区组成,该字符串的第一个字符是非UTF-8编码“\ff”。后续字符是不透明字段中原始字节的转义值。逃逸公约相对简单。转义由反斜杠和编码字节的两个十六进制数字组成。例如,字节0x2c的“\2c”。客户机自己处理不透明处理,因为算法相对简单且统一。

4.7.3. Client Side Syntax Checking
4.7.3. 客户端语法检查

Client side API implementations may do syntax checking of scope names, naming authority names, and service type names, but are not required to do so. Since the C API is designed to be a thin layer over the protocol, some low memory SA implementations may find extensive syntax checking on the client side to be burdensome. If syntax checking uncovers an error in a parameter, the SLP_PARAMETER_BAD error must be returned. If any parameter is NULL and is required to be nonNULL, SLP_PARAMETER_BAD is returned.

客户端API实现可以对作用域名称、命名机构名称和服务类型名称进行语法检查,但不需要这样做。由于C API被设计为协议上的一个薄层,一些低内存SA实现可能会发现客户端上的大量语法检查很麻烦。如果语法检查发现参数中存在错误,则必须返回SLP_parameter_BAD error。如果任何参数为NULL且要求为非NULL,则返回SLP_参数_BAD。

4.7.4. System Properties
4.7.4. 系统属性

The system properties established in the configuration file are accessible through the SLPGetProperty() and SLPSetProperty() functions. The SLPSetProperty() function only modifies properties in the running process, not in the configuration file. Properties are global to the process, affecting all threads and all handles created with SLPOpen. Errors are checked when the property is used and, as with parsing the configuration file, are logged. Program execution continues without interruption by substituting the default for the erroneous parameter. With the exception of net.slp.locale, net.slp.typeHint, and net.slp.maxResults, clients of the API should rarely be required to override these properties, since they reflect properties of the SLP network that are not of concern to individual agents. If changes are required, system administrators should modify the configuration file.

在配置文件中建立的系统属性可以通过SLPGetProperty()和SLPSetProperty()函数访问。函数的作用是:只修改正在运行的进程中的属性,而不修改配置文件中的属性。属性是进程的全局属性,影响使用SLPOpen创建的所有线程和所有句柄。在使用属性时会检查错误,并且与解析配置文件一样,会记录错误。通过将错误参数替换为默认值,程序继续执行,不会中断。除了net.slp.locale、net.slp.typeHint和net.slp.maxResults之外,API的客户端很少需要重写这些属性,因为它们反映的是slp网络的属性,这些属性与单个代理无关。如果需要更改,系统管理员应修改配置文件。

4.7.5. Memory Management
4.7.5. 内存管理

The only API functions returning memory specifically requiring deallocation on the part of the client are SLPParseSrvURL(), SLPFindScopes(), SLPEscape(), and SLPUnescape(). This memory should be freed using SLPFree() when no longer needed. Character strings returned via the SLPGetProperty() function should NOT be freed, they are owned by the SLP library.

唯一返回内存的API函数特别需要在客户端部分释放内存,它们是SLPParseSrvURL()、SLPFindScopes()、SLPEscape()和slpunsecase()。不再需要时,应使用SLPFree()释放此内存。不应释放通过SLPGetProperty()函数返回的字符串,它们属于SLP库。

Memory passed to callbacks belongs to the library and MUST NOT be retained by the client code. Otherwise, crashes are possible. Clients are required to copy data out of the callback parameters. No other use of the parameter memory in callback parameters is allowed.

传递给回调的内存属于库,不能由客户端代码保留。否则,可能发生崩溃。客户端需要从回调参数中复制数据。不允许在回调参数中使用参数内存。

4.7.6. Asynchronous and Incremental Return Semantics
4.7.6. 异步和增量返回语义

If a handle parameter to an API function was opened asynchronously, API function calls on the handle check the other parameters, open the appropriate operation and return immediately. In an error occurs in the process of starting the operation, an error code is returned. If the handle parameter was opened synchronously, the API function call blocks until all results are available, and returns only after the results are reported through the callback function. The return code indicates whether any errors occurred both starting and during the operation.

如果API函数的句柄参数是异步打开的,则对该句柄的API函数调用将检查其他参数,打开相应的操作并立即返回。如果在启动操作的过程中发生错误,将返回错误代码。如果handle参数是同步打开的,则API函数调用将阻塞,直到所有结果都可用,并且仅在通过回调函数报告结果后返回。返回代码指示在启动和操作期间是否发生任何错误。

The callback function is called whenever the API library has results to report. The callback code is required to check the error code parameter before looking at the other parameters. If the error code is not SLP_OK, the other parameters may be invalid. The API library has the option of terminating any outstanding operation on which an error occurs. The callback code can similarly indicate that the operation should be terminated by passing back SLP_FALSE. Callback functions are not permitted to recursively call into the API on the same SLPHandle. If an attempt is made to recursively call into the API, the API function returns SLP_HANDLE_IN_USE. Prohibiting recursive callbacks on the same handle simplifies implementation of thread safe code, since locks held on the handle will not be in place during a second outcall on the handle. On the other hand, it means that handle creation should be fairly lightweight so a client program can easily support multiple outstanding calls.

只要API库有结果要报告,就会调用回调函数。在查看其他参数之前,需要回调代码来检查错误代码参数。如果错误代码不是SLP_OK,则其他参数可能无效。API库可以选择终止发生错误的任何未完成操作。回调代码可以类似地指示应该通过传回SLP_FALSE来终止操作。不允许回调函数递归地调用同一SLPHandle上的API。如果试图递归调用API,API函数将返回SLP_HANDLE_IN_USE。禁止同一句柄上的递归回调简化了线程安全代码的实现,因为在句柄上的第二次出调用期间,句柄上持有的锁不会就位。另一方面,这意味着句柄创建应该是相当轻量级的,因此客户端程序可以轻松支持多个未完成的调用。

The total number of results received can be controlled by setting the net.slp.maxResults parameter.

通过设置net.slp.maxResults参数,可以控制接收的结果总数。

On the last call to a callback, whether asynchronous or synchronous, the status code passed to the callback has value SLP_LAST_CALL. There are four reasons why the call can terminate:

在对回调的最后一次调用(无论是异步还是同步)时,传递给回调的状态代码的值为SLP_last_call。呼叫可以终止的原因有四个:

DA reply received

已收到DA的答复

A reply from a DA has been received and therefore nothing more is expected.

已收到DA的回复,因此不需要更多。

Multicast terminated

多播终止

The multicast convergence time has elapsed and the API library multicast code is giving up.

多播聚合时间已过,API库多播代码正在放弃。

Multicast null results

多播空结果

Nothing new has been received during multicast for a while and the API library multicast code is giving up on that (as an optimization).

在多播期间有一段时间没有收到任何新消息,API库多播代码正在放弃这一点(作为优化)。

Maximum results

最大结果

The user has set the net.slp.maxResults property and that number of replies has been collected and returned

用户已设置net.slp.maxResults属性,并且已收集并返回该数量的回复

4.8. Example
4.8. 实例

This example illustrates how to discover a mailbox.

此示例演示了如何发现邮箱。

A POP3 server registers itself with the SLP framework. The attributes it registers are "USER", a list of all users whose mail is available through the POP3 server.

POP3服务器向SLP框架注册自身。它注册的属性是“USER”,即通过POP3服务器可以获得邮件的所有用户的列表。

The POP3 server code is the following:

POP3服务器代码如下所示:

   SLPHandle slph;
   SLPRegReport errCallback = POPRegErrCallback;
        
   SLPHandle slph;
   SLPRegReport errCallback = POPRegErrCallback;
        
   /* Create an English SLPHandle, asynchronous processing. */
        
   /* Create an English SLPHandle, asynchronous processing. */
        
   SLPError err = SLPOpen("en", SLP_TRUE, &slph);
        
   SLPError err = SLPOpen("en", SLP_TRUE, &slph);
        
   if( err != SLP_OK ) {
        
   if( err != SLP_OK ) {
        
     /* Deal with error. */
        
     /* Deal with error. */
        

}

}

   /* Create the service: URL and attribute parameters. */
        
   /* Create the service: URL and attribute parameters. */
        
   const char* surl = "service:pop3://mail.netsurf.de"; /* the URL */
        
   const char* surl = "service:pop3://mail.netsurf.de"; /* the URL */
        
   const char *pcAttrs = "(user=zaphod,trillian,roger,marvin)"
        
   const char *pcAttrs = "(user=zaphod,trillian,roger,marvin)"
        
   /* Perform the registration. */
        
   /* Perform the registration. */
        

err = SLPReg(slph, surl, SLP_LIFETIME_DEFAULT, ppcAttrs, errCallback, NULL);

err=SLPReg(slph、surl、SLP_life_DEFAULT、ppcAttrs、errCallback、NULL);

   if (err != SLP_OK ) {
        
   if (err != SLP_OK ) {
        
      /*Deal with error.*/
        
      /*Deal with error.*/
        

}

}

The errCallback reports any errors:

errCallback报告任何错误:

void POPRegErrCallback(SLPHandle hSLP, SLPError errCode, unsigned short usLifetime, void* pvCookie) {

void popregercallback(SLPHandle hSLP、slperor errCode、无符号短uslife、void*pvCookie){

      if( errCode != SLP_OK ) {
        
      if( errCode != SLP_OK ) {
        
        /* Report error through a dialog, message, etc. */
        
        /* Report error through a dialog, message, etc. */
        

}

}

      /*Use lifetime interval to update periodically. */
        
      /*Use lifetime interval to update periodically. */
        

}

}

The POP3 client locates the server for the user with the following code:

POP3客户端使用以下代码为用户定位服务器:

   /*
    * The client calls SLPOpen(), exactly as above.
    */
        
   /*
    * The client calls SLPOpen(), exactly as above.
    */
        
   const char *pcSrvType   = "service:pop3"; /* the service type  */
   const char *pcScopeList = "default";      /* the scope         */
   const char *pcFilter    = "(user=roger)"; /* the search filter */
   SLPSrvURLCallback srvCallback =           /* the callback      */
                                   POPSrvURLCallback;
        
   const char *pcSrvType   = "service:pop3"; /* the service type  */
   const char *pcScopeList = "default";      /* the scope         */
   const char *pcFilter    = "(user=roger)"; /* the search filter */
   SLPSrvURLCallback srvCallback =           /* the callback      */
                                   POPSrvURLCallback;
        

err = SLPFindSrvs(slph, pcSrvType, pcScopeList, pcFilter, srvCallback, NULL);

err=SLPFindSrvs(slph、pcSrvType、pcScopeList、pcFilter、srvCallback、NULL);

   if( err != SLP_OK ) {
        
   if( err != SLP_OK ) {
        
       /* Deal with error. */
        
       /* Deal with error. */
        

}

}

Within the callback, the client code can use the returned POP service:

在回调中,客户端代码可以使用返回的POP服务:

SLPBoolean POPSrvURLCallback(SLPHandle hSLP, const char* pcSrvURL, unsigned short sLifetime, SLPError errCode, void* pvCookie) {

SLPBoolean POPSrvURLCallback(SLPHandle hSLP、const char*pcSrvURL、无符号短sLifetime、slperor errCode、void*pvCookie){

     if( errCode != SLP_OK ) {
        
     if( errCode != SLP_OK ) {
        
        /* Deal with error. */
        
        /* Deal with error. */
        

}

}

SLPSrvURL* pSrvURL;

SLPSrvURL*pSrvURL;

     errCode = SLPParseSrvURL(pcSrvURL, &pSrvURL);
        
     errCode = SLPParseSrvURL(pcSrvURL, &pSrvURL);
        
     if (err != SLP_OK ) {
        
     if (err != SLP_OK ) {
        
       /* Deal with error. */
        
       /* Deal with error. */
        

} else {

}否则{

       /* get the server's address */
        
       /* get the server's address */
        
       struct hostent *phe = gethostbyname(pSrvURL.s_pcHost);
        
       struct hostent *phe = gethostbyname(pSrvURL.s_pcHost);
        
       /* use hostname in pSrvURL to connect to the POP3 server
        *     . . .
        */
        
       /* use hostname in pSrvURL to connect to the POP3 server
        *     . . .
        */
        
       SLPFreeSrvURL((void*)pSrvURL);  /* Free the pSrvURL storage */
     }
        
       SLPFreeSrvURL((void*)pSrvURL);  /* Free the pSrvURL storage */
     }
        
     return SLP_FALSE;                 /* Done! */
        
     return SLP_FALSE;                 /* Done! */
        

}

}

A client that wanted to discover all the users receiving mail at the server uses with the following query:

希望发现在服务器上接收邮件的所有用户的客户端使用以下查询:

   /*
    * The client calls SLPOpen(), exactly as above. We assume the
    * service: URL was retrieved into surl.
    */
        
   /*
    * The client calls SLPOpen(), exactly as above. We assume the
    * service: URL was retrieved into surl.
    */
        
   const char *pcScopeList = "default";      /* the scope            */
   const char *pcAttrFilter    = "use";      /* the attribute filter */
   SLPAttrCallback attrCallBack =            /* the callback         */
                                  POPUsersCallback
        
   const char *pcScopeList = "default";      /* the scope            */
   const char *pcAttrFilter    = "use";      /* the attribute filter */
   SLPAttrCallback attrCallBack =            /* the callback         */
                                  POPUsersCallback
        

err = SLPFindAttrs(slph, surl, pcScopeList, pcAttrFilter, attrCallBack, NULL);

err=SLPFindAttrs(slph、surl、pcScopeList、pcAttrFilter、attrCallBack、NULL);

   if( err != SLP_OK ) {
        
   if( err != SLP_OK ) {
        
        /* Deal with error. */
        
        /* Deal with error. */
        

}

}

The callback processes the attributes:

回调处理以下属性:

SLPBoolean POPUsersCallback(const char* pcAttrList, SLPError errCode, void* pvCookie) {

SLPBoolean POPUsersCallback(常量字符*pcAttrList,slperor错误代码,void*pvCookie){

     if( errCode != SLP_OK ) {
        
     if( errCode != SLP_OK ) {
        
       /* Deal with error. */
        
       /* Deal with error. */
        

} else {

}否则{

       /* Parse attributes. */
        
       /* Parse attributes. */
        

}

}

     return SLP_FALSE;  /* Done! */
        
     return SLP_FALSE;  /* Done! */
        

}

}

5. Java Language Binding
5. Java语言绑定
5.1. Introduction
5.1. 介绍

The Java API is designed to model the various SLP entities in classes and objects. APIs are provided for SA, UA, and service type template access capabilities. The ServiceLocationManager class contains methods that return instances of objects implementing SA and UA capability. Each of these is modeled in an interface. The Locator interface provides UA capability and the Advertiser interface provides SA capability. The TemplateRegistry abstract class contains methods that return objects for template introspection and attribute type checking. The ServiceURL, ServiceType, and ServiceLocationAttribute classes model the basic SLP concepts. A concrete subclass instance of TemplateRegistry is returned by a class method.

JavaAPI旨在对类和对象中的各种SLP实体进行建模。为SA、UA和服务类型模板访问功能提供API。ServiceLocationManager类包含返回实现SA和UA功能的对象实例的方法。其中每一个都在一个接口中建模。定位器接口提供UA功能,广告商接口提供SA功能。TemplateRegistry抽象类包含返回用于模板内省和属性类型检查的对象的方法。ServiceURL、ServiceType和ServiceLocationAttribute类为基本SLP概念建模。TemplateRegistry的具体子类实例由类方法返回。

All SLP classes and interfaces are located within a single package. The package name should begin with the name of the implementation and conclude with the suffix "slp". Thus, the name for a hypothetical implementation from the University of Michigan would look like:

所有SLP类和接口都位于单个包中。包名称应以实现的名称开头,并以后缀“slp”结尾。因此,密歇根大学的一个假想实施的名称看起来像:

edu.umich.slp

edu.umich.slp

This follows the Java convention of prepending the top level DNS domain name for the organization implementing the package onto the organization's name and using that as the package prefix.

这遵循Java约定,将实现包的组织的顶级DNS域名前置到组织的名称上,并将其用作包前缀。

5.2. Exceptions and Errors
5.2. 例外和错误

Most parameters to API methods are required to be non-null. The API description indicates if a null parameter is acceptable, or if other restrictions constrain a parameter. When parameters are checked for validity (such as not being null) or their syntax is checked, an error results in the RuntimeException subclass IllegalArgumentException being thrown. Clients of the API are reminded that IllegalArgumentException, derived from RuntimeException, is unchecked by the compiler. Clients should thus be careful to include try/catch blocks for it if the relevant parameters could be erroneous.

API方法的大多数参数都要求为非null。API描述指示空参数是否可接受,或者其他限制是否约束参数。当检查参数的有效性(例如不为null)或检查其语法时,将抛出RuntimeException子类IllegalArgumentException。提醒API的客户端,编译器将取消选中从RuntimeException派生的IllegalArgumentException。因此,如果相关参数可能错误,客户端应该小心地为其包含try/catch块。

Standard Java practice is to encode every exceptional condition as a separate subclass of Exception. Because of the relatively high cost in code size of Exception subclasses, the API contains only a single Exception subclass with different conditions being determined by an integer error code property. A subset, appropriate to Java, of the error codes described in Section 3 are available as constants on the ServiceLocationException class. The subset excludes error codes such

标准Java实践是将每个异常条件编码为一个单独的异常子类。由于异常子类的代码大小成本相对较高,API只包含一个异常子类,不同的条件由整数错误代码属性确定。第3节中描述的错误代码的一个子集(适用于Java)在ServiceLocationException类中作为常量提供。子集不包括错误代码,例如

as MEMORY_ALLOC_FAILED.

由于内存分配失败。

5.2.1. Class ServiceLocationException
5.2.1. 类ServiceLocationException
5.2.1.1. Synopsis
5.2.1.1. 提要

public class ServiceLocationException extends Exception

公共类ServiceLocationException扩展了异常

5.2.1.2. Description
5.2.1.2. 描述

The ServiceLocationException class is thrown by all methods when exceptional conditions occur in the SLP framework. The error code property determines the exact nature of the condition, and an optional message may provide more information.

当SLP框架中出现异常情况时,所有方法都会抛出ServiceLocationException类。error code属性确定条件的确切性质,可选消息可能提供更多信息。

5.2.1.3. Fields
5.2.1.3. 领域

public static final short LANGUAGE_NOT_SUPPORTED = 1 public static final short PARSE_ERROR = 2 public static final short INVALID_REGISTRATION = 3 public static final short SCOPE_NOT_SUPPORTED = 4 public static final short AUTHENTICATION_ABSENT = 6 public static final short AUTHENTICATION_FAILED = 7 public static final short INVALID_UPDATE = 13 public static final short REFRESH_REJECTED = 15 public static final short NOT_IMPLEMENTED = 16 public static final short NETWORK_INIT_FAILED 17 public static final short NETWORK_TIMED_OUT = 18 public static final short NETWORK_ERROR = 19 public static final short INTERNAL_SYSTEM_ERROR = 20 public static final short TYPE_ERROR = 21 public static final short BUFFER_OVERFLOW = 22

public static final short LANGUAGE_NOT_SUPPORTED=1 public static final short PARSE_ERROR=2 public static final short INVALID_REGISTRATION=3 public static final short SCOPE_NOT_SUPPORTED=4 public static final short AUTHENTICATION_缺席=6 public static final short AUTHENTICATION_FAILED=7 public static final short INVALID_UPDATE=13公共静态最终短消息刷新被拒绝=15公共静态最终短消息未实现=16公共静态最终短消息网络初始化失败17公共静态最终短消息网络超时=18公共静态最终短消息网络错误=19公共静态最终短消息内部系统错误=20公共静态最终短消息类型错误=21公共静态最终短缓冲区溢出=22

5.2.1.4. Instance Methods
5.2.1.4. 实例方法

public short getErrorCode()

公共短getErrorCode()

Return the error code. The error code takes on one of the static field values.

返回错误代码。错误代码采用一个静态字段值。

5.3. Basic Data Structures
5.3. 基本数据结构
5.3.1. Interface ServiceLocationEnumeration
5.3.1. 接口ServiceLocationEnumeration

public interface ServiceLocationEnumeration extends Enumeration

公共接口ServiceLocationEnumeration扩展了枚举

5.3.1.1. Description
5.3.1.1. 描述

The ServiceLocationEnumeration class is the return type for all Locator SLP operations. The Java API library may implement this class to block until results are available from the SLP operation, so that the client can achieve asynchronous operation by retrieving results from the enumeration in a separate thread. Clients use the superclass nextElement() method if they are unconcerned with SLP exceptions.

ServiceLocationEnumeration类是所有定位器SLP操作的返回类型。Java API库可以实现这个类来阻塞,直到SLP操作的结果可用为止,这样客户机就可以通过在单独的线程中检索枚举的结果来实现异步操作。如果客户机不关心SLP异常,则使用超类nextElement()方法。

5.3.1.2. Instance Methods
5.3.1.2. 实例方法

public abstract Object next() throws ServiceLocationException

公共抽象对象next()引发ServiceLocationException

Return the next value or block until it becomes available.

返回下一个值或块,直到它变为可用。

Throws:

抛出:

ServiceLocationException

ServiceLocationException

Thrown if the SLP operation encounters an error.

如果SLP操作遇到错误,则引发。

NoSuchElementException

非接触性异常

If there are no more elements to return.

如果没有更多要返回的元素。

5.3.2. Class ServiceLocationAttribute
5.3.2. 类ServiceLocationAttribute
5.3.2.1. Synopsis
5.3.2.1. 提要

public class ServiceLocationAttribute extends Object implements Serializable

公共类ServiceLocationAttribute扩展对象实现可序列化

5.3.2.2. Description
5.3.2.2. 描述

The ServiceLocationAttribute class models SLP attributes. Instances of this class are returned by Locator.findAttributes() and are communicated along with register/deregister requests.

ServiceLocationAttribute类为SLP属性建模。此类的实例由Locator.findAttributes()返回,并与注册/注销请求一起通信。

5.3.2.3. Constructors
5.3.2.3. 建设者

public ServiceLocationAttribute(String id,Vector values)

public ServiceLocationAttribute(字符串id、向量值)

Construct a service location attribute. Errors in the id or values vector result in an IllegalArgumentException.

构造服务位置属性。id或值向量中的错误会导致IllegalArgumentException。

Parameters:

参数:

id

身份证件

The attribute name. The String can consist of any Unicode character.

属性名。字符串可以由任何Unicode字符组成。

values

价值观

A Vector of one or more attribute values. Vector contents must be uniform in type and one of Integer, String, Boolean, or byte[]. If the attribute is a keyword attribute, then the parameter should be null. String values can consist of any Unicode character.

一个或多个属性值的向量。向量内容的类型必须一致,且为整数、字符串、布尔值或字节[]之一。如果属性是关键字属性,则参数应为null。字符串值可以由任何Unicode字符组成。

5.3.2.4. Class Methods
5.3.2.4. 类方法

public static String escapeId(String id)

公共静态字符串转义id(字符串id)

Returns an escaped version of the id parameter, suitable for inclusion in a query. Any reserved characters as specified in [7] are escaped using UTF-8 encoding. If any characters in the tag are illegal, throws IllegalArgumentException.

返回id参数的转义版本,适合包含在查询中。[7]中指定的任何保留字符都使用UTF-8编码进行转义。如果标记中的任何字符是非法的,则抛出IllegalArgumentException。

Parameters:

参数:

id

身份证件

The attribute id to escape. ServiceLocationException is thrown if any characters are illegal for an attribute tag.

要转义的属性id。如果属性标记的任何字符非法,则引发ServiceLocationException。

public static String escapeValue(Object value)

公共静态字符串转义值(对象值)

Returns a String containing the escaped value parameter as a string, suitable for inclusion in a query. If the parameter is a string, any reserved characters as specified in [7] are escaped using UTF-8 encoding. If the parameter is a byte array, then the escaped string begins with the nonUTF-8 sequence `\ff` and the rest of the string consists of the escaped bytes, which is the encoding for opaques. If the value parameter is a Boolean or Integer, then the returned string contains the object converted into a string. If the value is any type other than String, Integer, Boolean or byte[], an IllegalArgumentException is thrown.

以字符串形式返回包含转义值参数的字符串,该字符串适合包含在查询中。如果参数是字符串,则使用UTF-8编码对[7]中指定的所有保留字符进行转义。如果参数是字节数组,则转义字符串以非UTF-8序列`\ff`开始,其余字符串由转义字节组成,这是不透明的编码。如果value参数是布尔值或整数,则返回的字符串包含转换为字符串的对象。如果值是除字符串、整数、布尔值或字节[]以外的任何类型,则会引发IllegalArgumentException。

Parameters:

参数:

value

价值

The attribute value to be converted into a string and escaped.

要转换为字符串并转义的属性值。

5.3.2.5. Instance Methods
5.3.2.5. 实例方法

public Vector getValues()

公共向量getValues()

Returns a cloned vector of attribute values, or null if the attribute is a keyword attribute. If the attribute is single-valued, then the vector contains only one object.

返回属性值的克隆向量,如果属性是关键字属性,则返回null。如果属性是单值的,那么向量只包含一个对象。

public String getId()

公共字符串getId()

Returns the attribute's name.

返回属性的名称。

public boolean equals(Object o)

公共布尔等于(对象o)

Overrides Object.equals(). Two attributes are equal if their identifiers are equal and their value vectors contain the same number of equal values as determined by the Object equals() method. Values having byte[] type are equal if the contents of all byte arrays in both attribute vectors match. Note that the SLP string matching algorithm [7] MUST NOT be used for comparing attribute identifiers or string values.

重写Object.equals()。如果两个属性的标识符相等,并且它们的值向量包含由Object equals()方法确定的相同数量的相等值,则这两个属性是相等的。如果两个属性向量中所有字节数组的内容都匹配,则具有byte[]类型的值相等。请注意,SLP字符串匹配算法[7]不得用于比较属性标识符或字符串值。

public String toString()

公共字符串toString()

Overrides Object.toString(). The string returned contains a formatted representation of the attribute, giving the attribute's id, values, and the Java type of the values. The returned string is suitable for debugging purposes, but is not in SLP wire format.

重写Object.toString()。返回的字符串包含属性的格式化表示,给出属性的id、值和值的Java类型。返回的字符串适用于调试目的,但不是SLP wire格式。

public int hashCode()

公共int hashCode()

Overrides Object.hashCode(). Hashes on the attribute's identifier.

重写Object.hashCode()。对属性的标识符进行哈希运算。

5.3.3. Class ServiceType
5.3.3. 类服务类型
5.3.3.1. Synopsis
5.3.3.1. 提要

public class ServiceType extends Object implements Serializable

公共类ServiceType扩展对象实现可序列化

5.3.3.2. Description
5.3.3.2. 描述

The ServiceType object models the SLP service type. It parses a string based service type specifier into its various components, and contains property accessors to return the components. URL schemes, protocol service types, and abstract service types are all handled.

ServiceType对象为SLP服务类型建模。它将基于字符串的服务类型说明符解析为各种组件,并包含用于返回组件的属性访问器。URL方案、协议服务类型和抽象服务类型都被处理。

5.3.3.3. Constructors
5.3.3.3. 建设者

public ServiceType(String type)

公共服务类型(字符串类型)

Construct a service type object from the service type specifier. Throws IllegalArgumentException if the type name is syntactically incorrect.

从服务类型说明符构造服务类型对象。如果类型名称语法不正确,则引发IllegalArgumentException。

Parameters:

参数:

type

类型

The service type name as a String. If the service type is from a service: URL, the "service:" prefix must be intact.

以字符串形式显示服务类型名称。如果服务类型来自service:URL,“service:”前缀必须完整。

5.3.3.4. Methods
5.3.3.4. 方法

public boolean isServiceURL()

公共布尔值isServiceURL()

Returns true if the type name contains the "service:" prefix.

如果类型名称包含“服务:”前缀,则返回true。

public boolean isAbstractType()

公共布尔值isAbstractType()

Returns true if the type name is for an abstract type.

如果类型名称用于抽象类型,则返回true。

public boolean isNADefault()

公共布尔值isNADefault()

Returns true if the naming authority is the default, i.e. is the empty string.

如果命名机构为默认值,即为空字符串,则返回true。

public String getConcreteTypeName()

公共字符串getConcreteTypeName()

Returns the concrete type name in an abstract type, or the empty string if the service type is not abstract. For example, if the type name is "service:printing:ipp", the method returns "ipp". If the type name is "service:ftp", the method returns "".

返回抽象类型中的具体类型名称,如果服务类型不是抽象类型,则返回空字符串。例如,如果类型名为“service:printing:ipp”,则该方法返回“ipp”。如果类型名为“service:ftp”,则该方法返回“”。

public String getPrincipleTypeName()

公共字符串getPrincipleTypeName()

Returns the abstract type name for an abstract type, the protocol name in a protocol type, or the URL scheme for a generic URL. For example, in the abstract type name "service:printing:ipp", the method returns "printing". In the protocol type name "service:ftp", the method returns "ftp".

返回抽象类型的抽象类型名称、协议类型中的协议名称或通用URL的URL方案。例如,在抽象类型名称“service:printing:ipp”中,该方法返回“printing”。在协议类型名称“service:ftp”中,该方法返回“ftp”。

public String getAbstractTypeName()

公共字符串getAbstractTypeName()

If the type is an abstract type, returns the fully formatted abstract type name including the "service:" and naming authority but without the concrete type name or intervening colon. If not an abstract type, returns the empty string. For example, in the abstract type name "service:printing:ipp", the method returns "service:printing".

如果类型是抽象类型,则返回完全格式化的抽象类型名称,包括“服务:”和命名权限,但不包含具体类型名称或中间冒号。如果不是抽象类型,则返回空字符串。例如,在抽象类型名称“service:printing:ipp”中,该方法返回“service:printing”。

public String getNamingAuthority()

公共字符串getNamingAuthority()

Return the naming authority name, or the empty string if the naming authority is the default.

返回命名机构名称,如果命名机构是默认名称,则返回空字符串。

public boolean equals(Object obj)

公共布尔等于(对象obj)

Overrides Object.equals(). The two objects are equal if they are both ServiceType objects and the components of both are equal.

重写Object.equals()。如果这两个对象都是ServiceType对象且其组件都相等,则这两个对象相等。

public String toString()

公共字符串toString()

Returns the fully formatted type name, including the "service:" if the type was originally from a service: URL.

返回完全格式化的类型名称,包括“service:”如果该类型最初来自service:URL。

public int hashCode()

公共int hashCode()

Overrides Object.hashCode(). Hashes on the string value of the "service" prefix, naming authority, if any, abstract and concrete type names for abstract types, protocol type name for protocol types, and URL scheme for generic URLs.

重写Object.hashCode()。散列“服务”前缀的字符串值、命名机构(如果有)、抽象类型的抽象和具体类型名称、协议类型的协议类型名称以及通用URL的URL方案。

5.3.4. Class ServiceURL
5.3.4. 类服务URL
5.3.4.1. Synopsis
5.3.4.1. 提要

public class ServiceURL extends Object implements Serializable

公共类ServiceURL扩展对象实现可序列化

5.3.4.2. Description
5.3.4.2. 描述

The ServiceURL object models the advertised SLP service URL. It can be either a service: URL or a regular URL. These objects are returned from service lookup requests, and describe the registered services. This class should be a subclass of java.net.URL but can't since that class is final.

ServiceURL对象为播发的SLP服务URL建模。它可以是服务URL或常规URL。这些对象是从服务查找请求返回的,描述注册的服务。该类应该是java.net.URL的子类,但不能,因为该类是final。

5.3.4.3. Class Variables
5.3.4.3. 类变量

public static final int NO_PORT = 0

公共静态最终int NO_PORT=0

Indicates that no port information is required or was returned for this URL.

指示此URL不需要或未返回任何端口信息。

public static final int LIFETIME_NONE = 0

公共静态最终整数生存期\u NONE=0

Indicates that the URL has a zero lifetime. This value is never returned from the API, but can be used to create a ServiceURL object to deregister, delete attributes, or find attributes.

指示URL的生存期为零。此值从未从API返回,但可用于创建ServiceURL对象以取消注册、删除属性或查找属性。

public static final int LIFETIME_DEFAULT = 10800

公共静态最终整数生命周期\默认值=10800

The default URL lifetime (3 hours) in seconds.

默认URL生存期(3小时),以秒为单位。

public static final int LIFETIME_MAXIMUM = 65535

公共静态最终整数寿命_最大值=65535

The maximum URL lifetime (about 18 hours) in seconds.

URL的最大生存期(约18小时),以秒为单位。

public static final int LIFETIME_PERMANENT = -1

公共静态最终整数寿命_永久=-1

Indicates that the API implementation should continuously re-register the URL until the application exits.

指示API实现应持续重新注册URL,直到应用程序退出。

5.3.4.4. Constructors
5.3.4.4. 建设者

public ServiceURL(String URL,int lifetime)

公共服务URL(字符串URL,int生存期)

Construct a service URL object having the specified lifetime.

构造具有指定生存期的服务URL对象。

Parameters:

参数:

URL

统一资源定位地址

The URL as a string. Must be either a service: URL or a valid generic URL according to RFC 2396 [2].

将URL设置为字符串。根据RFC 2396[2],必须是服务:URL或有效的通用URL。

lifetime

一生

The service advertisement lifetime in seconds. This value may be between LIFETIME_NONE and LIFETIME_MAXIMUM.

服务广告的生存期(秒)。此值可能介于生存期\无和生存期\最大值之间。

5.3.4.5. Methods
5.3.4.5. 方法

public ServiceType getServiceType()

公共服务类型getServiceType()

Returns the service type object representing the service type name of the URL.

返回表示URL的服务类型名称的服务类型对象。

public final void setServiceType(ServiceType type) throws ServiceLocationException

public final void setServiceType(ServiceType类型)引发ServiceLocationException

Set the service type name to the object. Ignored if the URL is a service: URL.

将服务类型名称设置为对象。如果URL是服务:URL,则忽略。

Parameters:

参数:

type

类型

The service type object.

服务类型对象。

public String getTransport()

公共字符串getTransport()

Get the network layer transport identifier. If the transport is IP, an empty string, "", is returned.

获取网络层传输标识符。如果传输为IP,则返回空字符串“”。

public String getHost()

公共字符串getHost()

Returns the host identifier. For IP, this will be the machine name or IP address.

返回主机标识符。对于IP,这将是机器名或IP地址。

public int getPort()

公共int getPort()

Returns the port number, if any. For non-IP transports, always returns NO_PORT.

返回端口号(如果有)。对于非IP传输,始终不返回\u端口。

public String getURLPath()

公共字符串getURLPath()

Returns the URL path description, if any.

返回URL路径描述(如果有)。

public int getLifetime()

公共int getLifetime()

Returns the service advertisement lifetime. This will be a positive int between LIFETIME_NONE and LIFETIME_MAXIMUM.

返回服务播发生存期。这将是生存期\无和生存期\最大值之间的正整数。

public boolean equals(Object obj)

公共布尔等于(对象obj)

Compares the object to the ServiceURL and returns true if the two are the same. Two ServiceURL objects are equal if their current service types match and they have the same host, port, transport, and URL path.

将对象与ServiceURL进行比较,如果两者相同,则返回true。如果两个ServiceURL对象的当前服务类型匹配,并且它们具有相同的主机、端口、传输和URL路径,则它们是相等的。

public String toString()

公共字符串toString()

Returns a formatted string with the URL. Overrides Object.toString(). The returned URL has the original service type or URL scheme, not the current service type.

返回带有URL的格式化字符串。重写Object.toString()。返回的URL具有原始服务类型或URL方案,而不是当前服务类型。

public int hashCode()

公共int hashCode()

Overrides Object.hashCode(). Hashes on the current service type, transport, host, port, and URL part.

重写Object.hashCode()。对当前服务类型、传输、主机、端口和URL部分进行哈希。

5.4. SLP Access Interfaces
5.4. SLP访问接口
5.4.1. Interface Advertiser
5.4.1. 界面广告商
5.4.1.1. Synopsis
5.4.1.1. 提要

public interface Advertiser

公共界面广告商

5.4.1.2. Description
5.4.1.2. 描述

The Advertiser is the SA interface, allowing clients to register new service instances with SLP, to change the attributes of existing services, and to deregister service instances. New registrations and modifications of attributes are made in the language locale with which the Advertiser was created, deregistrations of service instances are made for all locales.

广告客户是SA接口,允许客户端向SLP注册新的服务实例,更改现有服务的属性,以及取消注册服务实例。在创建广告客户时使用的语言环境中进行新的属性注册和修改,取消所有环境中服务实例的注册。

5.4.1.3. Instance Methods
5.4.1.3. 实例方法

public abstract Locale getLocale()

公共抽象语言环境getLocale()

Return the language locale with which this object was created.

返回创建此对象时使用的语言区域设置。

public abstract void register(ServiceURL URL, Vector attributes) throws ServiceLocationException

公共抽象无效寄存器(ServiceURL URL、向量属性)引发ServiceLocationException

Register a new service with SLP having the given attributes.

向具有给定属性的SLP注册新服务。

The API library is required to perform the operation in all scopes obtained through configuration.

API库需要在通过配置获得的所有作用域中执行操作。

Parameters:

参数:

URL

统一资源定位地址

The URL for the service.

服务的URL。

attributes

属性

A vector of ServiceLocationAttribute objects describing the service.

描述服务的ServiceLocationAttribute对象的向量。

public abstract void deregister(ServiceURL URL) throws ServiceLocationException

公共抽象无效注销器(ServiceURL)引发ServiceLocationException

Deregister a service from the SLP framework. This has the effect of deregistering the service from every language locale. The API library is required to perform the operation in all scopes obtained through configuration.

从SLP框架中注销服务。这会从每个语言环境中取消注册服务。API库需要在通过配置获得的所有作用域中执行操作。

Parameters:

参数:

URL

统一资源定位地址

The URL for the service.

服务的URL。

public abstract void addAttributes(ServiceURL URL, Vector attributes) throws ServiceLocationException

公共抽象void addAttributes(ServiceURL URL、向量属性)引发ServiceLocationException

Update the registration by adding the given attributes. The API library is required to perform the operation in all scopes obtained through configuration.

通过添加给定属性更新注册。API库需要在通过配置获得的所有作用域中执行操作。

Parameters:

参数:

URL

统一资源定位地址

The URL for the service.

服务的URL。

attributes

属性

A Vector of ServiceLocationAttribute objects to add to the existing registration. Use an empty vector to update the URL alone. May not be null.

要添加到现有注册的ServiceLocationAttribute对象的向量。使用空向量单独更新URL。不能为空。

public abstract void deleteAttributes(ServiceURL URL, Vector attributeIds) throws ServiceLocationException

公共抽象void deleteAttributes(ServiceURL URL,Vector AttributeId)引发ServiceLocationException

Delete the attributes from a URL for the locale with which the Advertiser was created. The API library is required to perform the operation in all scopes obtained through configuration.

从创建广告客户的区域设置的URL中删除属性。API库需要在通过配置获得的所有作用域中执行操作。

Parameters:

参数:

URL

统一资源定位地址

The URL for the service.

服务的URL。

attributeIds

属性

A vector of Strings indicating the ids of the attributes to remove. The strings may be attribute ids or they may be wildcard patterns to match ids. See [7] for the syntax of wildcard patterns. The strings may include SLP reserved characters, they will be escaped by the API before transmission. May not be the empty vector or null.

字符串向量,指示要删除的属性的ID。字符串可以是属性ID,也可以是匹配ID的通配符模式。有关通配符模式的语法,请参见[7]。字符串可能包括SLP保留字符,它们将在传输前由API转义。不能为空向量或null。

5.4.2. Interface Locator
5.4.2. 接口定位器
5.4.2.1. Synopsis
5.4.2.1. 提要

public interface Locator

公共接口定位器

5.4.2.2. Description
5.4.2.2. 描述

The Locator is the UA interface, allowing clients to query the SLP framework about existing service types, services instances, and about the attributes of an existing service instance or service type. Queries for services and attributes are made in the locale with which the Locator was created, queries for service types are independent of locale.

定位器是UA接口,允许客户端向SLP框架查询现有服务类型、服务实例以及现有服务实例或服务类型的属性。对服务和属性的查询是在创建定位器的语言环境中进行的,对服务类型的查询独立于语言环境。

5.4.2.3. Instance Methods
5.4.2.3. 实例方法

public abstract Locale getLocale()

公共抽象语言环境getLocale()

Return the language locale with which this object was created.

返回创建此对象时使用的语言区域设置。

public abstract ServiceLocationEnumeration findServiceTypes(String namingAuthority, Vector scopes) throws ServiceLocationException

公共抽象ServiceLocationEnumeration findServiceTypes(字符串命名权限、向量作用域)引发ServiceLocationException

Returns an enumeration of ServiceType objects giving known service types for the given scopes and given naming authority. If no service types are found, an empty enumeration is returned.

返回ServiceType对象的枚举,这些对象提供给定范围和给定命名权限的已知服务类型。如果未找到服务类型,则返回空枚举。

Parameters:

参数:

namingAuthority

提名权

The naming authority. Use "" for the default naming authority and "*" for all naming authorities.

命名机构。默认命名机构使用“”,所有命名机构使用“*”。

scopes

范围

A Vector of scope names. The vector should be selected from the results of a findScopes() API invocation. Use "DEFAULT" for the default scope.

作用域名称的向量。应该从findScopes()API调用的结果中选择向量。对默认范围使用“DEFAULT”。

public abstract ServiceLocationEnumeration findServices(ServiceType type, Vector scopes, String searchFilter) throws ServiceLocationException

公共抽象ServiceLocationEnumeration findServices(ServiceType类型、向量作用域、字符串搜索筛选器)引发ServiceLocationException

Returns a vector of ServiceURL objects for services matching the query, and having a matching type in the given scopes. If no services are found, an empty enumeration is returned.

返回与查询匹配且在给定范围内具有匹配类型的服务的ServiceURL对象向量。如果未找到任何服务,则返回空枚举。

Parameters:

参数:

type

类型

The SLP service type of the service.

服务的SLP服务类型。

scopes

范围

A Vector of scope names. The vector should be selected from the results of a findScopes() API invocation. Use "DEFAULT" for the default scope.

作用域名称的向量。应该从findScopes()API调用的结果中选择向量。对默认范围使用“DEFAULT”。

searchFilter

搜索过滤器

An LDAPv3 [4] string encoded query. If the filter is empty, i.e. "", all services of the requested type in the specified scopes are returned. SLP reserved characters must be escaped in the query. Use ServiceLocationAttribute.escapeId() and ServiceLocationAttribute.escapeValue() to construct the query.

LDAPv3[4]字符串编码查询。如果筛选器为空,即“”,则返回指定范围内请求类型的所有服务。查询中必须转义SLP保留字符。使用ServiceLocationAttribute.escapeId()和ServiceLocationAttribute.escapeValue()构造查询。

public abstract ServiceLocationEnumeration findAttributes(ServiceURL URL, Vector scopes, Vector attributeIds) throws ServiceLocationException

公共抽象ServiceLocationEnumeration findAttributes(ServiceURL URL、向量作用域、向量属性ID)引发ServiceLocationException

For the URL and scope, return a Vector of ServiceLocationAttribute objects whose ids match the String patterns in the attributeIds Vector. The request is made in the language locale of the Locator. If no attributes match, an empty enumeration is returned.

对于URL和作用域,返回ServiceLocationAttribute对象的向量,其ID与attributeIds向量中的字符串模式匹配。请求是在定位器的语言区域设置中发出的。如果没有匹配的属性,则返回空枚举。

Parameters:

参数:

URL

统一资源定位地址

The URL for which the attributes are desired.

所需属性的URL。

scopes

范围

A Vector of scope names. The vector should be selected from the results of a findScopes() API invocation. Use "DEFAULT" for the default scope.

作用域名称的向量。应该从findScopes()API调用的结果中选择向量。对默认范围使用“DEFAULT”。

attributeIds

属性

A Vector of String patterns identifying the desired attributes. An empty vector means return all attributes. As described in [7], the patterns may include wildcards to match substrings. The strings may include SLP reserved characters, they will be escaped by the API before transmission.

识别所需属性的字符串模式向量。空向量表示返回所有属性。如[7]中所述,模式可以包括匹配子字符串的通配符。字符串可能包括SLP保留字符,它们将在传输前由API转义。

public abstract ServiceLocationEnumeration findAttributes(ServiceType type, Vector scopes, Vector attributeIds) throws ServiceLocationException

公共抽象ServiceLocationEnumeration findAttributes(ServiceType类型、向量作用域、向量属性ID)引发ServiceLocationException

For the type and scope, return a Vector of all ServiceLocationAttribute objects whose ids match the String patterns in the attributeIds Vector regardless of the Locator's locale. The request is made independent of language locale. If no attributes are found, an empty vector is returned.

对于类型和范围,返回所有ServiceLocationAttribute对象的向量,这些对象的ID与attributeIds向量中的字符串模式匹配,而不考虑定位器的区域设置。请求是独立于语言区域设置发出的。如果未找到属性,则返回空向量。

Parameters:

参数:

serviceType

服务类型

The service type.

服务类型。

scopes

范围

A Vector of scope names. The vector should be selected from the results of a findScopes() API invocation. Use "DEFAULT" for the default scope.

作用域名称的向量。应该从findScopes()API调用的结果中选择向量。对默认范围使用“DEFAULT”。

attributeIds

属性

A Vector of String patterns identifying the desired attributes. An empty vector means return all attributes. As described in [7], the patterns may include wildcards to match all prefixes or suffixes. The patterns may include SLP reserved characters, they will be escaped by the API before transmission.

识别所需属性的字符串模式向量。空向量表示返回所有属性。如[7]中所述,模式可以包括与所有前缀或后缀匹配的通配符。模式可能包括SLP保留字符,它们将在传输前由API转义。

5.5. The Service Location Manager
5.5. 服务位置管理器
5.5.1. Class ServiceLocationManager
5.5.1. 类ServiceLocationManager
5.5.1.1. Synopsis
5.5.1.1. 提要

public class ServiceLocationManager extends Object

公共类ServiceLocationManager扩展对象

5.5.1.2. Description
5.5.1.2. 描述

The ServiceLocationManager manages access to the service location framework. Clients obtain the Locator and Advertiser objects for UA and SA, and a Vector of known scope names from the ServiceLocationManager.

ServiceLocationManager管理对服务位置框架的访问。客户端从ServiceLocationManager获取UA和SA的定位器和广告客户对象,以及已知作用域名称的向量。

5.5.1.3. Class Methods
5.5.1.3. 类方法

public static int getRefreshInterval() throws ServiceLocationException

public static int getRefreshInterval()引发ServiceLocationException

Returns the maximum across all DAs of the min-refresh-interval attribute. This value satisfies the advertised refresh interval bounds for all DAs, and, if used by the SA, assures that no refresh registration will be rejected. If no DA advertises a min-refresh-interval attribute, a value of 0 is returned.

返回“最小刷新间隔”属性的所有DA的最大值。该值满足所有DA的公布刷新间隔界限,并且如果SA使用该值,则确保不会拒绝任何刷新注册。如果没有DA播发最小刷新间隔属性,则返回值0。

public static Vector findScopes() throws ServiceLocationException

公共静态向量findScopes()引发ServiceLocationException

Returns an Vector of strings with all available scope names. The list of scopes comes from a variety of sources, see Section 2.1 for the scope discovery algorithm. There is always at least one string in the Vector, the default scope, "DEFAULT".

返回包含所有可用作用域名称的字符串向量。范围列表来自各种来源,范围发现算法见第2.1节。向量中始终至少有一个字符串,默认范围为“default”。

public static Locator getLocator(Locale locale) throws ServiceLocationException

公共静态定位器getLocator(区域设置)引发ServiceLocationException

Return a Locator object for the given language Locale. If the implementation does not support UA functionality, returns null.

返回给定语言区域设置的定位器对象。如果实现不支持UA功能,则返回null。

Parameters:

参数:

locale

场所

The language locale of the Locator. The default SLP locale is used if null.

定位器的语言区域设置。如果为null,则使用默认的SLP区域设置。

public static Advertiser getAdvertiser(Locale locale) throws ServiceLocationException

公共静态广告商getAdvertiser(区域设置)抛出ServiceLocationException

Return an Advertiser object for the given language locale. If the implementation does not support SA functionality, returns null.

返回给定语言区域设置的广告客户对象。如果实现不支持SA功能,则返回null。

Parameters:

参数:

locale

场所

The language locale of the Advertiser. The default SLP locale is used if null.

广告商的语言环境。如果为null,则使用默认的SLP区域设置。

5.6. Service Template Introspection
5.6. 服务模板自省
5.6.1. Abstract Class TemplateRegistry
5.6.1. 抽象类TemplateRegistry
5.6.1.1. Synopsis
5.6.1.1. 提要

public abstract class TemplateRegistry

公共抽象类TemplateRegistry

5.6.1.2. Description
5.6.1.2. 描述

Subclasses of the TemplateRegistry abstract class provide access to service location templates [8]. Classes implementing TemplateRegistry perform a variety of functions. They manage the registration and access of service type template documents. They create attribute verifiers from service templates, for verification of attributes and introspection on template documents. Note that clients of the Advertiser are not required to verify attributes before registering (though they may get a TYPE_ERROR if the implementation supports type checking and there is a mismatch with the template).

TemplateRegistry抽象类的子类提供对服务位置模板的访问[8]。实现TemplateRegistry的类执行各种函数。它们管理服务类型模板文档的注册和访问。他们从服务模板创建属性验证器,用于验证属性和模板文档的内省。请注意,广告客户的客户机在注册之前不需要验证属性(尽管如果实现支持类型检查并且与模板不匹配,他们可能会得到TYPE_错误)。

5.6.1.3. Class Methods
5.6.1.3. 类方法

public static TemplateRegistry getTemplateRegistry();

公共静态TemplateRegistry getTemplateRegistry();

Returns the distinguished TemplateRegistry object for performing operations on and with service templates. Returns null if the implementation doesn't support TemplateRegistry functionality.

返回可分辨的TemplateRegistry对象,用于对服务模板执行操作。如果实现不支持TemplateRegistry功能,则返回null。

5.6.1.4. Instance Methods
5.6.1.4. 实例方法

public abstract void registerServiceTemplate(ServiceType type, String documentURL, Locale locale, String version) throws ServiceLocationException

公共抽象void registerServiceTemplate(ServiceType类型、字符串文档URL、区域设置、字符串版本)引发ServiceLocationException

Register the service template with the template registry.

在模板注册表中注册服务模板。

Parameters:

参数:

type

类型

The service type.

服务类型。

documentURL

文档URL

A string containing the URL of the template document. May not be the empty string.

包含模板文档URL的字符串。可能不是空字符串。

locale

场所

A Locale object containing the language locale of the template.

包含模板语言区域设置的区域设置对象。

version

版本

The version number identifier of template document.

模板文档的版本号标识符。

public abstract void

公开摘要无效

deregisterServiceTemplate(ServiceType type, Locale locale, String version) throws ServiceLocationException

注销ServiceTemplate(ServiceType类型、区域设置、字符串版本)引发ServiceLocationException

Deregister the template for the service type.

取消注册服务类型的模板。

Parameters:

参数:

type

类型

The service type.

服务类型。

locale

场所

A Locale object containing the language locale of the template.

包含模板语言区域设置的区域设置对象。

version

版本

A String containing the version number. Use null to indicate the latest version.

包含版本号的字符串。使用null表示最新版本。

public abstract String findTemplateURL(ServiceType type, Locale locale, String version) throws ServiceLocationException

公共抽象字符串findTemplateURL(ServiceType类型、区域设置、字符串版本)引发ServiceLocationException

Returns the URL for the template document.

返回模板文档的URL。

Parameters:

参数:

type

类型

The service type.

服务类型。

locale

场所

A Locale object containing the language locale of the template.

包含模板语言区域设置的区域设置对象。

version

版本

A String containing the version number. Use null to indicate the latest version.

包含版本号的字符串。使用null表示最新版本。

public abstract ServiceLocationAttributeVerifier attributeVerifier(String documentURL) throws ServiceLocationException

公共抽象ServiceLocationAttributeVerifier attributeVerifier(字符串文档URL)引发ServiceLocationException

Reads the template document URL and returns an attribute verifier for the service type. The attribute verifier can be used for verifying that registration attributes match the template, and for introspection on the template definition.

读取模板文档URL并返回服务类型的属性验证器。属性验证器可用于验证注册属性是否与模板匹配,以及对模板定义进行自省。

Parameters:

参数:

documentURL

文档URL

A String containing the template document's URL. May not be the empty string.

包含模板文档URL的字符串。可能不是空字符串。

5.6.2. Interface ServiceLocationAttributeVerifier
5.6.2. 接口ServiceLocationAttributeVerifier
5.6.2.1. Synopsis
5.6.2.1. 提要
   public interface ServiceLocationAttributeVerifier
        
   public interface ServiceLocationAttributeVerifier
        
5.6.2.2. Description
5.6.2.2. 描述

The ServiceLocationAttributeVerifier provides access to service templates. Classes implementing this interface parse SLP template definitions, provide information on attribute definitions for service types, and verify whether a ServiceLocationAttribute object matches a template for a particular service type. Clients obtain ServiceLocationAttributeVerifier objects for specific SLP service types through the TemplateRegistry.

ServiceLocationAttributeVerifier提供对服务模板的访问。实现此接口的类解析SLP模板定义,提供有关服务类型的属性定义的信息,并验证ServiceLocationAttribute对象是否与特定服务类型的模板匹配。客户机通过TemplateRegistry获取特定SLP服务类型的ServiceLocationAttributeVerifier对象。

5.6.2.3. Instance Methods
5.6.2.3. 实例方法

public abstract ServiceType getServiceType()

公共抽象服务类型getServiceType()

Returns the SLP service type for which this is the verifier.

返回此验证程序所针对的SLP服务类型。

public abstract Locale getLocale()

公共抽象语言环境getLocale()

Return the language locale of the template.

返回模板的语言区域设置。

public abstract String getVersion()

公共抽象字符串getVersion()

Return the template version number identifier.

返回模板版本号标识符。

public abstract String getURLSyntax()

公共抽象字符串getURLSyntax()

Return the URL syntax expression for the service: URL.

返回服务的URL语法表达式:URL。

public abstract String getDescription()

公共抽象字符串getDescription()

Return the descriptive help text for the template.

返回模板的说明性帮助文本。

public abstract ServiceLocationAttributeDescriptor getAttributeDescriptor(String attrId)

公共抽象服务位置AttributeDescriptor getAttributeDescriptor(字符串属性ID)

Return the ServiceLocationAttributeDescriptor for the attribute having the named id. If no such attribute exists in this template, return null. This method is primarily for GUI tools to display attribute information. Programmatic verification of attributes should use the verifyAttribute() method.

返回具有命名id的属性的ServiceLocationAttributeDescriptor。如果此模板中不存在此类属性,则返回null。此方法主要用于GUI工具显示属性信息。属性的编程验证应使用verifyAttribute()方法。

public abstract Enumeration getAttributeDescriptors()

公共抽象枚举getAttributeDescriptors()

Returns an Enumeration allowing introspection on the attribute definition in the service template. The Enumeration returns ServiceLocationAttributeDescriptor objects for the attributes. This method is primarily for GUI tools to display attribute information. Programmatic verification of attributes should use the verifyAttribute() method.

返回允许对服务模板中的属性定义进行内省的枚举。枚举返回属性的ServiceLocationAttributeDescriptor对象。此方法主要用于GUI工具显示属性信息。属性的编程验证应使用verifyAttribute()方法。

public abstract void verifyAttribute( ServiceLocationAttribute attribute) throws ServiceLocationException

公共抽象void verifyAttribute(ServiceLocationAttribute属性)引发ServiceLocationException

Verify that the attribute matches the template definition. If the attribute doesn't match, ServiceLocationException is thrown with the error code as ServiceLocationException.PARSE_ERROR.

验证该属性是否与模板定义匹配。如果属性不匹配,则抛出ServiceLocationException,错误代码为ServiceLocationException.PARSE_error。

Parameters:

参数:

attribute

属性

The ServiceLocationAttribute object to be verified.

要验证的ServiceLocationAttribute对象。

public abstract void verifyRegistration( Vector attributeVector) throws ServiceLocationException

公共抽象void verifyRegistration(Vector attributeVector)引发ServiceLocationException

Verify that the Vector of ServiceLocationAttribute objects matches the template for this service type. The vector must contain all the required attributes, and all attributes must match their template definitions. If the attributes don't match, ServiceLocationException is thrown with the error code as ServiceLocationException.PARSE_ERROR

验证ServiceLocationAttribute对象的向量是否与此服务类型的模板匹配。向量必须包含所有必需的属性,并且所有属性必须与其模板定义匹配。如果属性不匹配,则抛出ServiceLocationException,错误代码为ServiceLocationException.PARSE\u error

Parameters:

参数:

attributeVector

属性因子

A Vector of ServiceLocationAttribute objects for the registration.

注册的ServiceLocationAttribute对象的向量。

5.6.3. Interface ServiceLocationAttributeDescriptor
5.6.3. 接口ServiceLocationAttributeDescriptor
5.6.3.1. Synopsis
5.6.3.1. 提要
   public interface
   ServiceLocationAttributeDescriptor
        
   public interface
   ServiceLocationAttributeDescriptor
        
5.6.3.2. Description
5.6.3.2. 描述

The ServiceLocationAttributeDescriptor interface provides introspection on a template attribute definition. Classes implementing the ServiceLocationAttributeDescriptor interface return information on a particular service location attribute definition from the service template. This information is primarily for GUI tools. Programmatic attribute verification should be done through the ServiceLocationAttributeVerifier.

ServiceLocationAttributeDescriptor接口提供对模板属性定义的自省。实现ServiceLocationAttributeDescriptor接口的类从服务模板返回有关特定服务位置属性定义的信息。此信息主要用于GUI工具。编程属性验证应通过ServiceLocationAttributeVerifier完成。

5.6.3.3. Instance Methods
5.6.3.3. 实例方法

public abstract String getId()

公共抽象字符串getId()

Return a String containing the attribute's id.

返回包含属性id的字符串。

public abstract String getValueType()

公共抽象字符串getValueType()

Return a String containing the fully package-qualified Java type of the attribute. SLP types are translated into Java types as follows:

返回一个字符串,该字符串包含属性的完全包限定Java类型。SLP类型转换为Java类型,如下所示:

STRING

一串

"java.lang.String"

“java.lang.String”

INTEGER

整数

"java.lang.Integer"

“java.lang.Integer”

BOOLEAN

布尔值

"java.lang.Boolean"

“java.lang.Boolean”

OPAQUE

不透明的

"[B" (i.e. array of byte, byte[])

“[B”(即字节数组,字节[])

KEYWORD

关键词

empty string, ""

空字符串“”

public abstract String getDescription()

公共抽象字符串getDescription()

Return a String containing the attribute's help text.

返回包含属性帮助文本的字符串。

public abstract Enumeration getAllowedValues()

公共抽象枚举getAllowedValues()

Return an Enumeration of allowed values for the attribute type. For keyword attributes returns null. For no allowed values (i.e. unrestricted) returns an empty Enumeration.

返回属性类型允许值的枚举。For关键字属性返回null。For no allowed value(即unrestricted)返回空枚举。

public abstract Enumeration getDefaultValues()

公共抽象枚举getDefaultValues()

Return an Enumeration of default values for the attribute type. For keyword attributes returns null. For no allowed values (i.e. unrestricted) returns an empty Enumeration.

返回属性类型的默认值的枚举。For关键字属性返回null。For no allowed value(即unrestricted)返回空枚举。

public abstract boolean getRequiresExplicitMatch()

公共抽象布尔值GetRequireExplicitMatch()

Returns true if the "X"" flag is set, indicating that the attribute should be included in an any Locator.findServices() request search filter.

如果设置了“X”标志,则返回true,指示属性应包含在any Locator.findServices()请求搜索筛选器中。

public abstract boolean getIsMultivalued()

公共抽象布尔GetIsMultiValue()

Returns true if the "M" flag is set.

如果设置了“M”标志,则返回true。

public abstract boolean getIsOptional()

公共抽象布尔getIsOptional()

Returns true if the "O"" flag is set.

如果设置了“O”标志,则返回true。

public abstract boolean getIsLiteral()

公共抽象布尔getIsLiteral()

Returns true if the "L" flag is set.

如果设置了“L”标志,则返回true。

public abstract boolean getIsKeyword()

公共抽象布尔getIsKeyword()

Returns true if the attribute is a keyword attribute.

如果属性是关键字属性,则返回true。

5.7. Implementation Notes
5.7. 实施说明
5.7.1. Refreshing Registrations
5.7.1. 刷新注册

A special lifetime constant, ServiceURL.LIFETIME_PERMANENT, is used by clients to indicate that the URL should be automatically refreshed until the application exits. The API implementation should interpret this flag as indicating that the URL lifetime is ServiceURL.LIFETIME_MAXIMUM, and MUST arrange for automatic refresh to occur.

客户端使用一个特殊的生存期常量ServiceURL.lifetime_PERMANENT来指示URL应自动刷新,直到应用程序退出。API实现应将此标志解释为指示URL生存期为ServiceURL.lifetime_最大值,并且必须安排自动刷新。

5.7.2. Parsing Alternate Transports in ServiceURL
5.7.2. 解析ServiceURL中的备用传输

The ServiceURL class is designed to handle multiple transports. The standard API performs no additional processing on transports other than IP except to separate out the host identifier and the URL path. However, implementations are free to subclass ServiceURL and support additional methods that provide more detailed parsing of alternate transport information. For IP transport, the port number, if any, is

ServiceURL类设计用于处理多个传输。除了分离主机标识符和URL路径之外,标准API不会对IP以外的传输执行其他处理。但是,实现可以自由地将ServiceURL子类化,并支持提供备用传输信息更详细解析的其他方法。对于IP传输,端口号(如果有)为

returned from the getPort() method. For non-IP transports, the getPort() method returns NO_PORT.

从getPort()方法返回。对于非IP传输,getPort()方法不返回\u端口。

5.7.3. String Attribute Values
5.7.3. 字符串属性值

In general, translation between Java types for attribute values and the SLP on-the-wire string is straightforward. However, there are two corner cases. If the Java attribute value type is String and the value of the string has an on-the-wire representation that is inferred by SLP as an integer, the registered attribute value may not be what the API client intended. A similar problem could result if the Java attribute value is the string "true" or "false", in which case the on-the-wire representation is inferred to boolean. To handle these corner cases, the Java API prepends a space onto the string. So, for example, if the string attribute value is "123", the Java API transforms the value to "123 ", which will have an on-the-wire representation that is inferred by SLP to be string. Since appended and prepended spaces have no effect on query handling, this procedure should cause no problem with queries. API clients need to be aware, however, that the transformation is occurring.

一般来说,属性值的Java类型与连接字符串上的SLP之间的转换非常简单。然而,有两种极端情况。如果Java属性值类型为String,并且该字符串的值具有在线表示形式(由SLP推断为整数),则注册的属性值可能不是API客户机想要的。如果Java属性值是字符串“true”或“false”,则可能会导致类似的问题,在这种情况下,在线表示被推断为布尔值。为了处理这些特殊情况,JavaAPI在字符串前面加了一个空格。因此,例如,如果string属性值为“123”,那么javaapi将该值转换为“123”,这将具有在线表示,SLP将其推断为string。由于追加空格和前置空格对查询处理没有影响,因此此过程不会导致查询出现问题。然而,API客户机需要知道转换正在发生。

5.7.4. Client Side Syntax Checking
5.7.4. 客户端语法检查

The syntax of scope names, service type names, naming authority names, and URLs is described in [7] and [8]. The various methods and classes taking String parameters for these entities SHOULD type check the parameters for syntax errors on the client side, and throw an IllegalArgumentException if an error occurs. In addition, character escaping SHOULD be implemented before network transmission for escapable characters in attribute ids and String values. This reduces the number of error messages transmitted. The ServiceLocationAttribute class provides methods for clients to obtain escaped attribute id and value strings to facilitate query construction.

[7]和[8]中描述了作用域名称、服务类型名称、命名机构名称和URL的语法。为这些实体获取字符串参数的各种方法和类应在客户端键入检查语法错误的参数,并在发生错误时抛出IllegalArgumentException。此外,对于属性ID和字符串值中的可转义字符,应在网络传输之前实现字符转义。这减少了传输的错误消息的数量。ServiceLocationAttribute类为客户端提供了获取转义属性id和值字符串的方法,以便于查询构造。

5.7.5. Language Locale Handling
5.7.5. 语言区域设置处理

The Locator and Advertiser interfaces are created with a Locale parameter. The language locale with which these objects are created is used in all SLP requests issued through the object. If the Locale parameter is null, the default SLP locale is used. The default SLP locale is determined by, first, checking the net.slp.locale System property. If that is unset, then the default SLP locale [7] is used, namely "en". Note that the default SLP locale may not be the same as the default Java locale.

定位器和广告客户接口是使用区域设置参数创建的。在通过对象发出的所有SLP请求中使用创建这些对象的语言区域设置。如果区域设置参数为null,则使用默认的SLP区域设置。默认的SLP区域设置首先通过检查net.SLP.locale系统属性来确定。如果未设置,则使用默认的SLP语言环境[7],即“en”。请注意,默认SLP语言环境可能与默认Java语言环境不同。

5.7.6. Setting SLP System Properties
5.7.6. 设置SLP系统属性

SLP system properties that are originally set in the configuration file can be overridden programmatically in API clients by simply invoking the System.getProperties() operation to get a copy of the system properties, modifying or adding the SLP property in question, then using System.setProperties() to set the properties to the modified Property object. Program execution continues without interruption by substituting the default for the erroneous parameter. Errors are checked when the property is used and are logged.

最初在配置文件中设置的SLP系统属性可以通过编程方式在API客户端中重写,方法是调用system.getProperties()操作以获取系统属性的副本,修改或添加有问题的SLP属性,然后使用system.setProperties()将属性设置为修改的属性对象。通过将错误参数替换为默认值,程序继续执行,不会中断。使用和记录属性时会检查错误。

The SLP configuration file cannot be read with the java.util.Properties file reader because there are some syntactic differences. The SLP configuration file syntax defines a different escape convention for non-ASCII characters than the Java syntax. However, after the file has been read, the properties are stored and retrieved from java.util.Properties objects.

无法使用java.util.Properties文件读取器读取SLP配置文件,因为存在一些语法差异。SLP配置文件语法为非ASCII字符定义了与Java语法不同的转义约定。但是,在读取文件后,将从java.util.properties对象存储和检索属性。

Properties are global for a process, affecting all threads and all Locator and Advertiser objects obtained through the ServiceLocationManager. With the exception of the net.slp.locale, net.slp.typeHint, and net.slp.maxResults properties, clients should rarely be required to override these properties, since they reflect properties of the SLP network that are not of concern to individual agents. If changes are required, system administrators should modify the configuration file.

属性是进程的全局属性,影响通过ServiceLocationManager获得的所有线程以及所有定位器和广告客户对象。除了net.slp.locale、net.slp.typeHint和net.slp.maxResults属性之外,客户机很少需要重写这些属性,因为它们反映的是slp网络的属性,这些属性与单个代理无关。如果需要更改,系统管理员应修改配置文件。

5.7.7. Multithreading
5.7.7. 多线程

Thread-safe operation is relatively easy to achieve in Java. By simply making each method in the classes implementing the Locator and Advertiser interfaces synchronized, and by synchronizing access to any shared data structures within the class, the Locator and Advertiser interfaces are made safe. Alternatively, finer grained synchronization is also possible within the classes implementing Advertiser and Locator.

线程安全操作在Java中相对容易实现。通过简单地使实现定位器和广告客户接口的类中的每个方法同步,并通过同步对类中任何共享数据结构的访问,定位器和广告客户接口变得安全。或者,在实现广告客户和定位器的类中也可以实现更细粒度的同步。

5.7.8. Modular Implementations
5.7.8. 模块化实现

While, at first glance, the API may look rather heavyweight, the design has been carefully arranged so that modular implementations that provide only SA, only UA, or only service template access capability, or any combination of the three, are possible.

虽然乍一看,API可能看起来相当重,但设计经过仔细安排,使得仅提供SA、UA、或仅提供服务模板访问能力或三者任意组合的模块化实现成为可能。

Because the objects returned from the ServiceLocationManager.getLocator() and ServiceLocationManager.getAdvertiser() operations are interfaces, and because the objects returned through those interfaces are in the set

因为从ServiceLocationManager.getLocator()和ServiceLocationManager.getAdvertiser()操作返回的对象是接口,并且通过这些接口返回的对象在集合中

of base data structures, an implementation is free to omit either UA or SA capability by simply returning null from the instance creation operation if the classes implementing the missing function cannot be dynamically linked. API clients are encouraged to check for such a contingency, and to signal an exception if it occurs. Similarly, the TemplateRegistry concrete subclass can simply be omitted from an implementation that only supports UA and/or SA clients, and the TemplateRegistry.getRegistry() method can return null. In this way, the API implementation can be tailored for the particular memory requirements at hand.

对于基本数据结构,如果实现缺少的函数的类不能动态链接,则实现可以通过简单地从实例创建操作返回null来省略UA或SA功能。鼓励API客户检查此类意外事件,并在发生异常时发出异常信号。类似地,在只支持UA和/或SA客户端的实现中可以省略TemplateRegistry的具体子类,TemplateRegistry.getRegistry()方法可以返回null。通过这种方式,API实现可以针对手头的特定内存需求进行定制。

In addition, if an implementation only supports the minimal subset of SLP [7], the unsupported Locator and Advertiser interface operations can throw an exception with ServiceLocationException.NOT_IMPLEMENTED as the error code. This supports better source portability between low and high memory platforms.

此外,如果实现仅支持SLP[7]的最小子集,则不受支持的定位器和广告客户接口操作可能会引发ServiceLocationException.NOT_作为错误代码实现的异常。这支持在低内存和高内存平台之间实现更好的源代码可移植性。

5.7.9. Asynchronous and Incremental Return Semantics
5.7.9. 异步和增量返回语义

The Java API contains no specific support for asynchronous operation. Incremental return is not needed for the Advertiser because service registrations can be broken up into pieces when large. Asynchronous return is also not needed because clients can always issue the Advertiser operation in a separate thread if the calling thread can't block.

JavaAPI不包含对异步操作的特定支持。对于广告客户来说,增量回报是不需要的,因为服务注册量大时可能会被分解成碎片。异步返回也是不需要的,因为如果调用线程无法阻止,客户端总是可以在单独的线程中发出广告客户操作。

The Locator can be implemented either synchronously or asynchronously. Since the return type for Locator calls is ServiceLocationEnumeration, a Java API implementation that supports asynchronous semantics can implement ServiceLocationEnumeration to dole results out as they come in, blocking when no results are available. If the client code needs to support other processing while the results are trickling in, the call into the enumeration to retrieve the results can be done in a separate thread.

定位器可以同步或异步实现。由于定位器调用的返回类型是ServiceLocationEnumeration,因此支持异步语义的Java API实现可以实现ServiceLocationEnumeration,以便在结果出现时分发结果,在没有可用结果时阻塞。如果客户端代码需要在结果逐渐进入时支持其他处理,则可以在单独的线程中调用枚举以检索结果。

Unlike the C case, collation semantics for return of attributes when an attribute request by service type is made require that the API collate returned values so that only one attribute having a collation of all returned values appear to the API client. In practice, this may limit the amount of asynchronous processing possible with the findAttributes() method. This requirement is imposed because memory management is much easier in Java and so implementing collation as part of the API should not be as difficult as in C, and it saves the client from having to do the collation.

与C情况不同,当按服务类型发出属性请求时,属性返回的排序规则语义要求API对返回值进行排序,以便API客户端只显示一个具有所有返回值排序规则的属性。实际上,这可能会限制FinDatAttributes()方法可能进行的异步处理量。之所以提出这一要求,是因为Java中的内存管理要容易得多,因此将排序规则作为API的一部分实现应该不像C中那样困难,而且它使客户机不必进行排序。

5.8. Example
5.8. 实例

In this example, a printer server advertises its availability to clients. Additionally, the server advertises a service template for use by client software in validating service requests:

在本例中,打印机服务器向客户端播发其可用性。此外,服务器播发服务模板,供客户端软件在验证服务请求时使用:

//Get the Advertiser and TemplateRegistry.

//获得广告商和TemplateRegistry。

Advertiser adv = null; TemplateRegistry tr = null

广告客户adv=null;TemplateRegistry tr=null

try {

试一试{

    adv = ServiceLocationManager.getAdvertiser("en");
        
    adv = ServiceLocationManager.getAdvertiser("en");
        
    tr = TemplateRegistry.getTemplateRegistry();
        
    tr = TemplateRegistry.getTemplateRegistry();
        

} catch( ServiceLocationException ex ) { } //Deal with error.

}catch(ServiceLocationException ex){}//处理错误。

  if( adv == null ) {
        
  if( adv == null ) {
        
    //Serious error as printer can't be registered
    //  if the implementation doesn't support SA
    //  functionality.
        
    //Serious error as printer can't be registered
    //  if the implementation doesn't support SA
    //  functionality.
        

}

}

  //Get the printer's attributes, from a file or
  //  otherwise. We assume that the attributes
  //  conform to the template, otherwise, we
  //  could register the template here and verify
  //  them.
        
  //Get the printer's attributes, from a file or
  //  otherwise. We assume that the attributes
  //  conform to the template, otherwise, we
  //  could register the template here and verify
  //  them.
        
  Vector attributes = getPrinterAttributes();
        
  Vector attributes = getPrinterAttributes();
        

//Create the service: URL for the printer.

//为打印机创建服务:URL。

  ServiceURL printerURL =
    new ServiceURL(
      "service:printer:lpr://printshop/color2",
      ServiceURL.LIFETIME_MAXIMUM);
        
  ServiceURL printerURL =
    new ServiceURL(
      "service:printer:lpr://printshop/color2",
      ServiceURL.LIFETIME_MAXIMUM);
        

try {

试一试{

//Register the printer.

//注册打印机。

adv.register(printerURL, attributes);

高级寄存器(printerURL,属性);

//If the template registry is available, // register the printer's template.

//如果模板注册表可用,//注册打印机的模板。

    if( tr != null ) {
      tr.registerServiceTemplate(
        new ServiceType("service:printer:lpr"),
        "http://shop.arv/printer/printer-lpr.slp",
        new Locale("en",""),
        "1.0");
        
    if( tr != null ) {
      tr.registerServiceTemplate(
        new ServiceType("service:printer:lpr"),
        "http://shop.arv/printer/printer-lpr.slp",
        new Locale("en",""),
        "1.0");
        

}

}

} catch( ServiceLocationException ex ) { } //Deal with error.

}catch(ServiceLocationException ex){}//处理错误。

Suppose a client is looking for color printer. The following code is used to issue a request for printer advertisements:

假设客户正在寻找彩色打印机。以下代码用于发出打印机广告请求:

  Locator loc = null;
  TemplateRegistry tr = null;
        
  Locator loc = null;
  TemplateRegistry tr = null;
        

try {

试一试{

    loc = ServiceLocationManager.getLocator("en");
        
    loc = ServiceLocationManager.getLocator("en");
        

} catch( ServiceLocationException ex ) { } //Deal with error.

}catch(ServiceLocationException ex){}//处理错误。

  if( loc == null ) {
        
  if( loc == null ) {
        
    //Serious error as client can't be located
    //  if the implementation doesn't support
    //  UA functionality.
        
    //Serious error as client can't be located
    //  if the implementation doesn't support
    //  UA functionality.
        

}

}

//We want a color printer that does CMYK // and prints at least 600 dpi.

//我们需要一台彩色打印机,它可以打印CMYK//并且打印速度至少为600 dpi。

  String query = "(&(marker-type=CMYK)(resolution=600))";
        
  String query = "(&(marker-type=CMYK)(resolution=600))";
        

//Get scopes.

//获取示波器。

  Vector scopes = ServiceLocationManager.findScopes();
        
  Vector scopes = ServiceLocationManager.findScopes();
        

Enumeration services;

查点服务;

try {

试一试{

    services =
      loc.findServices(new ServiceType("service:printer"),scopes,query);
        
    services =
      loc.findServices(new ServiceType("service:printer"),scopes,query);
        

} catch { } //Deal with error.

}catch{}//处理错误。

if (services.hasMoreElements() ) {

if(services.hasMoreElements()){

    //Printers can now be used.
    ServiceURL surl = (ServiceURL) services.next();
        
    //Printers can now be used.
    ServiceURL surl = (ServiceURL) services.next();
        
    Socket sock = new Socket(surl.getHost, surl.getPort());
        
    Socket sock = new Socket(surl.getHost, surl.getPort());
        

// Use the Socket...

//使用插座。。。

}

}

6. Internationalization Considerations
6. 国际化考虑
6.1. service URL
6.1. 服务URL

The service URL itself must be encoded using the rules set forth in [2]. The character set encoding is limited to specific ranges within the UTF-8 character set [3].

服务URL本身必须使用[2]中规定的规则进行编码。字符集编码仅限于UTF-8字符集内的特定范围[3]。

The attribute information associated with the service URL must be expressed in UTF-8. See [8] for attribute internationalization guidelines.

与服务URL关联的属性信息必须用UTF-8表示。有关属性国际化准则,请参见[8]。

6.2. Character Set Encoding
6.2. 字符集编码

Configuration and serialized registration files are encoded in the UTF-8 character set [3]. This is fully compatible with US-ASCII character values. C platforms that do not support UTF-8 are required to check the top bit of input bytes to determine whether the incoming character is multibyte. If it is, the character should be dealt with accordingly. This should require no additional implementation effort, since the SLP wire protocol requires that strings are encoded as UTF-8. C platforms without UTF-8 support need to supply their own support, if only in the form of multibyte string handling.

配置和序列化的注册文件以UTF-8字符集编码[3]。这与US-ASCII字符值完全兼容。不支持UTF-8的C平台需要检查输入字节的顶部位,以确定传入字符是否为多字节。如果是,则应相应地处理该字符。这不需要额外的实现工作,因为SLP wire协议要求字符串编码为UTF-8。不支持UTF-8的C平台需要提供自己的支持,如果只是以多字节字符串处理的形式。

At the API level, the character encoding is specified to be Unicode for Java and UTF-8 for C. Unicode is the default in Java. For C, the standard US-ASCII 8 bits per character, null terminated C strings are a subset of the UTF-8 character set, and so work in the API. Because the C API is very simple, the API library needs to do a minimum of processing on UTF-8 strings. The strings primarily just need to be reflected into the outgoing SLP messages, and reflected out of the

在API级别,字符编码对于Java指定为Unicode,对于C指定为UTF-8。Unicode是Java中的默认值。对于C,标准的US-ASCII每个字符8位,以null结尾的C字符串是UTF-8字符集的子集,因此在API中工作。因为C API非常简单,所以API库需要对UTF-8字符串进行最少的处理。字符串主要只需要反射到传出的SLP消息中,并从

API from incoming SLP messages.

来自传入SLP消息的API。

6.3. Language Tagging
6.3. 语言标记

All SLP requests and registrations are tagged to indicate in which language the strings included are encoded. This allows multiple languages to be supported. It also presents the possibility that error conditions result when a request is made in a language that is not supported. In this case, an error is only returned when there is data available, but not obtainable in the language requested.

所有SLP请求和注册都会被标记,以指示所包含字符串的编码语言。这允许支持多种语言。它还表明,当请求使用不受支持的语言时,可能会出现错误情况。在这种情况下,只有当有可用的数据时,才会返回错误,但不能以请求的语言获取数据。

The dialect portion of the Language Tag is used on 'best effort' basis for matching strings by SLP. Dialects that match are preferred over those which don't. Dialects that do not match will not prevent string matching or comparisons from occurring.

Language标记的方言部分在“尽力”的基础上用于SLP匹配字符串。匹配的方言比不匹配的方言更受欢迎。不匹配的方言不会阻止字符串匹配或比较的发生。

7. Security Considerations
7. 安全考虑

Security is handled within the API library and is not exposed to API clients except in the form of exceptions. The net.slp.securityEnabled, property determines whether an SA client's messages are signed, but a UA client should be prepared for an authentication exception at any time, because it may contact a DA with authenticated advertisements.

安全性是在API库中处理的,并且不会向API客户端公开,除非以异常的形式。net.slp.securityEnabled属性确定SA客户端的消息是否已签名,但UA客户端应随时为身份验证异常做好准备,因为它可能会使用经过身份验证的播发联系DA。

An adversary could delete valid service advertisements, provide false service information and deny UAs knowledge of existing services unless the mechanisms in SLP for authenticating SLP messages are used. These mechanisms allow DAAdverts, SAAdverts, Service URLs and Service Attributes to be verified using digital cryptography. For this reason, all SLP agents should be configured to use SLP SPIs. See [7] for a description of how this mechanism works.

除非使用SLP中用于验证SLP消息的机制,否则对手可以删除有效的服务广告、提供虚假的服务信息并拒绝UAs对现有服务的了解。这些机制允许使用数字加密技术验证数据广告客户、数据广告客户、服务URL和服务属性。因此,应将所有SLP代理配置为使用SLP SPI。有关此机制如何工作的说明,请参见[7]。

8. Acknowledgements
8. 致谢

The authors would like to thank Don Provan for his pioneering work during the initial stages of API definition.

作者要感谢Don Provan在API定义的初始阶段所做的开创性工作。

9. References
9. 工具书类

[1] Bradner, S., "Key Words for Use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.

[1] Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,1997年3月。

[2] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform Resource Identifiers (URI): Generic Syntax", RFC 2396, August 1998.

[2] Berners Lee,T.,Fielding,R.和L.Masinter,“统一资源标识符(URI):通用语法”,RFC 2396,1998年8月。

[3] Yergeau, F., "UTF-8, a transformation format of ISO 10646", RFC 2279, January 1998.

[3] “UTF-8,ISO 10646的转换格式”,RFC 2279,1998年1月。

[4] Howes, T., "The String Representation of LDAP Search Filters", RFC 2254 December 1997.

[4] Howes,T.,“LDAP搜索过滤器的字符串表示”,RFC 2254,1997年12月。

[5] Crocker, D. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", RFC 2234, November 1997.

[5] Crocker,D.和P.Overell,“语法规范的扩充BNF:ABNF”,RFC 2234,1997年11月。

[6] Alvestrand, H., "Tags for the Identification of Languages", RFC 1766, March 1995.

[6] Alvestrand,H.,“语言识别标签”,RFC1766,1995年3月。

[7] Guttman, E., Perkins, C., Veizades, J. and M. Day, "Service Location Protocol, Version 2", RFC 2608, June 1999.

[7] Guttman,E.,Perkins,C.,Veizades,J.和M.Day,“服务位置协议,版本2”,RFC 26081999年6月。

[8] Guttman, E., Perkins, C. and J. Kempf, "Service Templates and Service: Schemes", RFC 2609, June 1999.

[8] Guttman,E.,Perkins,C.和J.Kempf,“服务模板和服务:方案”,RFC 26091999年6月。

10. Authors' Addresses
10. 作者地址

Questions about this memo can be directed to:

有关本备忘录的问题,请联系:

James Kempf Sun Microsystems 901 San Antonio Rd. Palo Alto, CA, 94303 USA

美国加利福尼亚州帕洛阿尔托市圣安东尼奥路901号詹姆斯·肯普夫太阳微系统公司,邮编94303

   Phone: +1 650 786 5890
   Fax:   +1 650 786 6445
   EMail: james.kempf@sun.com
        
   Phone: +1 650 786 5890
   Fax:   +1 650 786 6445
   EMail: james.kempf@sun.com
        

Erik Guttman Sun Microsystems Bahnstr. 2 74915 Waibstadt Germany

埃里克·古特曼太阳微系统公司。274915德国威伯斯塔特

   Phone: +49 7263 911 701
   EMail: erik.guttman@sun.com
        
   Phone: +49 7263 911 701
   EMail: erik.guttman@sun.com
        
11. Full Copyright Statement
11. 完整版权声明

Copyright (C) The Internet Society (1999). All Rights Reserved.

版权所有(C)互联网协会(1999年)。版权所有。

This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.

本文件及其译本可复制并提供给他人,对其进行评论或解释或协助其实施的衍生作品可全部或部分编制、复制、出版和分发,不受任何限制,前提是上述版权声明和本段包含在所有此类副本和衍生作品中。但是,不得以任何方式修改本文件本身,例如删除版权通知或对互联网协会或其他互联网组织的引用,除非出于制定互联网标准的需要,在这种情况下,必须遵循互联网标准过程中定义的版权程序,或根据需要将其翻译成英语以外的其他语言。

The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.

上述授予的有限许可是永久性的,互联网协会或其继承人或受让人不会撤销。

This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE."

本文件和其中包含的信息是按“原样”提供的,互联网协会和互联网工程任务组否认所有明示或暗示的保证,包括但不限于任何保证,即使用本文中的信息不会侵犯任何权利,或对适销性或特定用途适用性的任何默示保证。”

Acknowledgement

确认

Funding for the RFC Editor function is currently provided by the Internet Society.

RFC编辑功能的资金目前由互联网协会提供。