mkDPIregister()--Make a DPI Register Packet


  Syntax
 #include <qtossapi.h>

 unsigned char     *mkDPIregister(
     unsigned short     timeout,
     long int           priority,
     char               *group_p,
     char               bulk_select);   


  Service Program Name: QTOSSAPI

  Default Public Authority: *USE

  Threadsafe: No

The mkDPIregister() function makes a Distributed Protocol Interface (DPI®) register packet and returns a pointer to the packet.


Authorities and Locks

None.


Parameters

timeout
(Input) The requested timeout in seconds. An agent often has a limit for this value, and it will use that limit if this value is larger. The value zero has special meaning in the sense that it tells the agent to use the timeout value that was specified in the DPI OPEN packet.

priority
(Input) The requested priority, relative to other DPI subagents. This field may contain any of these values:
-1 The best available priority.
0 A better priority than the highest priority currently registered. Use this value to obtain the SNMP DPI version 1 behavior.
nnn Any other positive value. You will receive that priority if available; otherwise, the next best priority that is available.

group_p
(Input) A pointer to a NULL-terminated character string that represents the subtree to be registered. This group ID must have a trailing dot.

bulk_select
(Input) Whether you want the agent to pass GETBULK on to the subagent or to map them into multiple GETNEXT requests. The possible value follows:
DPI_BULK_NO Do not pass any GETBULK requests, but instead map a GETBULK request into multiple GETNEXT requests.

Return Value

value The mkDPIregister() function was successful. The value returned is a pointer to the DPI packet.

If successful, then a pointer to a static DPI packet buffer is returned. The first 2 bytes of the buffer (in network byte order) contain the length of the remaining packet. The DPI_PACKET_LEN function can be used to calculate the total length of the DPI packet.

NULL The mkDPIregister() function was not successful.

If unsuccessful, then a NULL pointer is returned.

Be aware that the static buffer for the DPI packet is shared by other mkDPIxxxx() functions that create a serialized DPI packet.

For more information, see the Simple Network Management Protocol (SNMP) SupportLink to PDF manual.


Usage Notes

The mkDPIregister() function creates a serialized DPI REGISTER packet that can then be sent to the SNMP agent.

The SNMP agent will send a DPI response packet back to the subagent with a code that can be used to determine if the register request was successful. This will be one of the SNMP_ERROR_DPI_* return codes found in <qtossapi.h>. Following receipt of this response packet, the subagent will need to call the pDPIpacket() to parse the incoming DPI packet and to check the response packet error_code. Then, fDPIparse() would normally be called to free the parsed DPI packet.

If the response from the SNMP agent is SNMP_ERROR_DPI_higherPriorityRegistered, then a DPI subagent has already registered the same subtree at a higher priority than requested in this call. If so, this subagent will be contained in the subagent Management Information Base (MIB), and using an appropriate SNMP management application, you can determine its priority. You may want to consider requesting a higher priority or even -1 (best available) for your subagent.

If the response from the SNMP agent is SNMP_ERROR_DPI_alreadyRegistered, then the requested subtree registration was for a portion of the overall MIB that is supported by an SNMP agent directly or by other system-implemented programs. Generally, registration of any subtree root, which would have the effect of masking all or portions of these subtrees (if allowed to occur), is prohibited.

Not all protected subtrees are currently supplied on a System i® platform, although most are. If a subtree is currently not supplied, then the first subagent that dynamically registers it will be allowed, and later subagents will be disallowed. Refer to the "SNMP Agent Set Processing and Supported SNMP MIBs" in the Simple Network Management Protocol (SNMP) Support Link to PDF manual for information about the MIB groups currently supplied with IBM® i.

Following are the protected subtrees and the associated MIB name:

1.3.6.1.2.1.1 System
1.3.6.1.2.1.2 Interfaces
1.3.6.1.2.1.3 Address translation
1.3.6.1.2.1.4 Internet Protocol
1.3.6.1.2.1.5 Internet Control Message Protocol
1.3.6.1.2.1.6 Transmission Control Protocol (TCP)
1.3.6.1.2.1.7 User Datagram Protocol (UDP)
1.3.6.1.2.1.10.7 Ethernet
1.3.6.1.2.1.10.9 Token ring
1.3.6.1.2.1.10.15 Fiber distributed data interface (FDDI)
1.3.6.1.2.1.10.32 Frame relay
1.3.6.1.2.1.11 SNMP
1.3.6.1.2.1.25 Host
1.3.6.1.3.6 Interface extensions
1.3.6.1.4.1.2.2.12 Subagent
1.3.6.1.4.1.2.2.1 Distributed Protocol Interface (DPI) (See the Internet standard RFC 1592, "Simple Network Management Protocol Distributed Protocol Interface", Version 1.0.)
1.3.6.1.4.1.2.6.2.13 Advanced Peer-to-Peer Networking® (APPN)
1.3.6.1.4.1.2.6.4.5 NetView/6000 subagent computer system group
1.3.6.1.4.1.2.6.50 Client management
1.3.6.1.4.1.23.2.5 Internetwork Packet Exchange (IPX) protocol
1.3.6.1.4.1.23.2.19 Netware Link Services Protocol (NLSP)
1.3.6.1.4.1.23.2.20 Router Information Protocol (RIP) and Service Advertising Protocol (SAP)

Related Information


Example

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

  #include <qtossapi.h>
  unsigned char *pack_p;

  pack_p = mkDPIregister(0,0L,"1.3.6.1.2.3.4.5.",
                         DPI_BULK_NO);
  if (pack_p) {
     /* Send packet to agent and await response. */
  }



API introduced: V3R6

[ Back to top | UNIX-Type APIs | APIs by category ]