This section describes the commands that can be specified in a call to the XcvData or XcvDataPort function, when it is communicating with the standard TCP/IP port monitor (TCPMON). Each command is specified by the pszDataName string in the call to these functions. 某些命令需要输入缓冲区或输出缓冲区,或两者兼有。 The pInputData and pOutputData parameters of these functions hold the addresses of these buffers.
The table that appears in the description of each of the following commands lists the XcvData and XcvDataPort parameters that are used with the commands. Note that the hXcv parameter (common to both functions) is not listed, nor is the XcvData function's pdwStatus parameter.
AddPort command
The AddPort command adds a standard TCP/IP port, which can be either an LPR port or a RAW TCP/IP port.
| XcvData parameter | Value |
|---|---|
| pszDataName | L"AddPort" |
| pInputData | Address of a PORT_DATA_1 structure |
| cbInputData | sizeof(PORT_DATA_1) |
| pOutputData | NULL |
| cbOutputData | 0 |
| pcbOutputNeeded | DWORD 的地址 |
XcvData returns NO_ERROR if it can add the port. In addition to the normal error codes, XcvData returns ERROR_ACCESS_DENIED if the user has insufficient privileges to create a port on the server. 此命令需要SERVER_ACCESS_ADMINISTER特权。 If the pInputData parameter is NULL, the function returns ERROR_INVALID_DATA. If pInputData-->dwVersion is not equal to 1, the function returns ERROR_INVALID_LEVEL.
ConfigPort command
The ConfigPort command configures an existing standard TCP/IP port monitor port.
| XcvData parameter | Value |
|---|---|
| pszDataName | L"ConfigPort" |
| pInputData | Address of a PORT_DATA_1 structure |
| cbInputData | sizeof(PORT_DATA_1) |
| pOutputData | NULL |
| cbOutputData | 0 |
| pcbOutputNeeded | DWORD 的地址 |
XcvData returns NO_ERROR if it can configure the port. In addition to the normal error codes, XcvData returns ERROR_ACCESS_DENIED if the caller has insufficient privileges to perform the request. 此命令需要SERVER_ACCESS_ADMINISTER特权。 If the pInputData parameter is NULL, or the value in cbInputData is smaller than required, the function returns ERROR_INVALID_DATA. If pInputData-->dwVersion is not equal to 1, the function returns ERROR_INVALID_LEVEL.
DeletePort command
The DeletePort command deletes a port from the standard TCP/IP port monitor.
| XcvData parameter | Value |
|---|---|
| pszDataName | L"DeletePort" |
| pInputData | Address of DELETE_PORT_DATA_1 structure |
| cbInputData | sizeof(DELETE_PORT_DATA_1) |
| pOutputData | NULL |
| cbOutputData | 0 |
| pcbOutputNeeded | DWORD 的地址 |
XcvData returns NO_ERROR if the port is successfully deleted. In addition to the normal error codes, XcvData returns ERROR_ACCESS_DENIED if the caller has insufficient privileges on the server. 此命令需要SERVER_ACCESS_ADMINISTER特权。 If the pInputData parameter is NULL, or if the cbInputData parameter is smaller than required, the function returns ERROR_INVALID_DATA. If pInputData-->dwVersion is not equal to 1, the function returns ERROR_INVALID_LEVEL.
GetConfigInfo command
The GetConfigInfo command obtains the configuration information of a particular port. 在这种情况下,Xcv 数据句柄必须指向特定的标准 TCP/IP 端口监视器端口,以便可以识别该端口。
| XcvData parameter | Value |
|---|---|
| pszDataName | L"GetConfigInfo" |
| pInputData | Address of a CONFIG_INFO_DATA_1 structure |
| cbInputData | sizeof(CONFIG_INFO_DATA_1) |
| pOutputData | Address of a PORT_DATA_1 structure |
| cbOutputData | sizeof(PORT_DATA_1) |
| pcbOutputNeeded | Address of a DWORD containing the number of bytes needed for the buffer pointed to by pOutputData |
XcvData returns NO_ERROR if it can obtain the configuration information for the port. If pInputData is NULL, or if cbInputData is smaller than required, the function returns ERROR_INVALID_DATA. If pInputData-->dwVersion is not equal to 1, the function returns ERROR_INVALID_LEVEL. If cbOutputData is smaller than required, the function returns ERROR_INVALID_PARAMETER when pcbOutputNeeded is NULL, and ERROR_INSUFFICIENT_BUFFER when pcbOutputNeeded is non-NULL.
HostAddress command
The HostAddress command gets the printer's host name.
| XcvData parameter | Value |
|---|---|
| pszDataName | L"HostAddress" |
| pInputData | NULL |
| cbInputData | 0 |
| pOutputData | 接收包含打印机主机名的字符串的缓冲区的地址 |
| cbOutputData | Size of the buffer pointed to by pOutputData |
| pcbOutputNeeded | Address of a DWORD containing the number of bytes needed for the buffer pointed to by pOutputData |
XcvData returns NO_ERROR if it can obtain the name of the printer's host. If cbOutputData is smaller than required, the function returns ERROR_INVALID_PARAMETER when pcbOutputNeeded is NULL, and ERROR_INSUFFICIENT_BUFFER when pcbOutputNeeded is non-NULL. If pOutputData is NULL, the function returns ERROR_INVALID_PARAMETER.
IPAddress command
The IPAddress command gets the printer's IP address.
| XcvData parameter | Value |
|---|---|
| pszDataName | L"IPAddress" |
| pInputData | NULL |
| cbInputData | 0 |
| pOutputData | 接收包含打印机 IP 地址的字符串的缓冲区的地址 |
| cbOutputData | Size of the buffer pointed to by pOutputData |
| pcbOutputNeeded | Address of a DWORD containing the number of bytes needed for the buffer pointed to by pOutputData |
XcvData returns NO_ERROR if it can obtain the printer's IP address. If cbOutputData is smaller than required, the function returns ERROR_INVALID_PARAMETER when pcbOutputNeeded is NULL, and ERROR_INSUFFICIENT_BUFFER when pcbOutputNeeded is non-NULL. If pOutputData is NULL, the function returns ERROR_INVALID_PARAMETER.
MonitorUI command
The MonitorUI command gets the name of the port monitor UI DLL that provides an interface to TCPMON.
| XcvData parameter | Value |
|---|---|
| pszDataName | L"MonitorUI" |
| pInputData | NULL |
| cbInputData | 0 |
| pOutputData | 接收端口监视器用户界面 DLL 名称的缓冲区的地址 |
| cbOutputData | 包含端口监视器用户界面 DLL 名称的字符串中的字节数 |
| pcbOutputNeeded | Address of a DWORD containing the number of bytes needed for the buffer pointed to by pOutputData |
XcvData returns NO_ERROR if it is able to obtain the name of the user interface DLL. In addition to the normal error codes, XcvData returns ERROR_ACCESS_DENIED if the caller has insufficient privileges on the server. 此命令需要SERVER_ACCESS_ADMINISTER特权。 If cbOutputData is smaller than required, the function returns ERROR_INVALID_PARAMETER when pcbOutputNeeded is NULL, and ERROR_INSUFFICIENT_BUFFER when pcbOutputNeeded is non-NULL. If pOutputData is NULL, the function returns ERROR_INVALID_PARAMETER.
SNMPCommunity
The SNMPCommunity command gets the Simple Network Management Protocol (SNMP) community name for a printer.
| XcvData parameter | Value |
|---|---|
| pszDataName | L"SNMPCommunity" |
| pInputData | NULL |
| cbInputData | 0 |
| pOutputData | 接收包含打印机 SNMP 社区的字符串的缓冲区的地址 |
| cbOutputData | Size of the buffer needed to contain the string pointed to by the pOutputData parameter |
| pcbOutputNeeded | Address of a DWORD containing the number of bytes needed for the buffer pointed to by pOutputData |
XcvData returns NO_ERROR if it can get the printer's SNMP community name. If cbOutputData is smaller than required, the function returns ERROR_INVALID_PARAMETER when pcbOutputNeeded is NULL, and ERROR_INSUFFICIENT_BUFFER when pcbOutputNeeded is non-NULL. If pOutputData is NULL, the function returns ERROR_INVALID_PARAMETER.
SNMPDeviceIndex
The SNMPDeviceIndex command gets the Simple Network Management Protocol (SNMP) device index of the printer.
| XcvData parameter | Value |
|---|---|
| pszDataName | L"SNMPDeviceIndex" |
| pInputData | NULL |
| cbInputData | 0 |
| pOutputData | 接收设备索引的缓冲区的地址 |
| cbOutputData | sizeof(DWORD) |
| pcbOutputNeeded | Address of a DWORD that contains sizeof(DWORD) |
XcvData returns NO_ERROR if it can get the printer's SNMP device index. If cbOutputData is smaller than required, the function returns ERROR_INVALID_PARAMETER when pcbOutputNeeded is NULL, and ERROR_INSUFFICIENT_BUFFER when pcbOutputNeeded is non-NULL. If pOutputData is NULL, the function returns ERROR_INVALID_PARAMETER.
SNMPEnabled
The SNMPEnabled command determines whether the Simple Network Management Protocol (SNMP) is enabled for the current device.
| XcvData parameter | Value |
|---|---|
| pszDataName | L"SNMPEnabled" |
| pInputData | NULL |
| cbInputData | 0 |
| pOutputData | 接收 DWORD 值的缓冲区的地址 |
| cbOutputData | sizeof(DWORD) |
| pcbOutputNeeded | Address of a DWORD that contains sizeof(DWORD) |
XcvData returns NO_ERROR if SNMP is enabled for the device. If cbOutputData is smaller than required, the function returns ERROR_INVALID_PARAMETER when pcbOutputNeeded is NULL, and ERROR_INSUFFICIENT_BUFFER when pcbOutputNeeded is non-NULL. If pOutputData is NULL, the function returns ERROR_INVALID_PARAMETER.