Contenues dans
Trouver plus de documentation
Ressources d'assistance comprises
| Télécharger cet ouvrage au format PDF
NAME
- netmgt_register_callback - register a transient RPC callback function
SYNOPSIS
-
u_long
-
-
netmgt_register_callback(callback, udp_sock, tcp_sock, vers, proto)
void (* callback)();
int * udp_sock;
int * tcp_sock;
u_long vers;
u_long proto;
DESCRIPTION
-
netmgt_register_callback allocates a transient RPC callback program number, creates RPC service transport handles associated with udp_sock and/or tcp_sock, and associates the callback RPC program number with the service dispatch function callback on the local host. This is done to establish a rendezvous for receiving data or event reports.
- When a report is received on the local host, callback is called with the following arguments:
-
u_int type
- report type -- either NETMGT_DATA_REPORT, NETMGT_EVENT_REPORT, NETMGT_TRAP_REPORT, or NETMGT_ERROR_REPORT.
-
char * target
- name of the target system (where the managed element resides).
-
char * group
- name of the group whose attribute values are to be retrieved.
-
char * key
- optional row identifier for tables. An instance of the group on the managed system . This is used if the group is a table with more than one possible row.
-
u_int count
- the reporting count.
-
timeval interval
- the reporting interval.
-
u_int flags
- report options.
INPUT ARGUMENTS
-
callback function that will handle reports as they arrive.
-
udp_sock
- socket descriptor associated with a UDP transport RPC callback function. This should be set to RPC_ANYSOCK if you don't want to specify a socket descriptor.
-
tcp_sock
- socket descriptor associated with a TCP transport RPC callback function. This should be set to RPC_ANYSOCK if you don't want to specify a socket descriptor.
-
-
vers
- RPC callback function version number.
-
-
proto
- transport protocol of the callback function. Specify
- IPROTO_UDP|IPPROTO_TCP. The result of this setting is that UDP transport is used for messages of 6144 bytes or less; TCP transport is used for messages longer than 6144 bytes. Because of this feature, if you registered, for example, only with UDP, you would not receive any large reports. If there is a possibility that you will receive reports larger than 6144 bytes, you should register with both TCP and UDP. This argument creates two sockets that must be closed just before calling netmgt_unregister_callback(3N). (See ``NOTES'' below.)
RETURN VALUE
- A transient RPC program number, if successful, otherwise NULL.
DIAGNOSTICS
- If NULL is returned, global variable netmgt_error indicates the error. The caller can get the reason for the error with netmgt_fetch_error(3N).
SEE ALSO
-
netmgt_fetch_error(3N), netmgt_unregister_callback(3N),
NOTES
- The caller must call netmgt_unregister_callback(3N) to unregister the transient RPC program number before exiting. Otherwise, the non-existent program number will continue to be registered with the local portmapper. The calling program should close both UDP and TCP sockets. These sockets should be closed just before calling
-
netmgt_unregister_callback(3N), or your program may run out of file descriptors.
|
|