z/OS Communications Server: IP Programmer's Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


C example – SIOCSPARTNERINFO and SIOCGPARTNERINFO ioctl calls

z/OS Communications Server: IP Programmer's Guide and Reference
SC27-3659-02

The following sample C code builds and issues the SIOCSPARTNERINFO and SIOCGPARTNERINFO ioctl calls. The SIOCGPARTNERINFO ioctl retrieves the connection routing information and the security credentials of a partner. The optional SIOCSPARTNERINFO ioctl enables an application to avoid suspending while retrieving partner security credentials with the SIOCGPARTNERINFO ioctl.

⋮
#include <sys/ioctl.h>
#include <termios.h>
⋮
#include "ezbpinfc.h"               /* SIOCSPARTNERINFO and
                                       SIOCGPARTNERINFO ioctls          */
⋮
   char *buff     = NULL;
   int   s;
   int   function = PI_REQTYPE_SET_PARTNERDATA;
   int   bufsiz;
⋮
   /*********************************************************************/
   /* issue the SIOCSPARTNERINFO ioctl to avoid suspending              */
   /*********************************************************************/
   rc = ioctl(s, 
              SIOCSPARTNERINFO,
              (char *)&function, 
              sizeof(function)); 
⋮ 
   bufsiz = PI_FIXED_SIZE + PI_UTOKEN_EXT_SIZE; 
   buff = (char *)__malloc31(bufsiz);  

   if (buff != NULL)    
   {
     memset(buff,0,bufsiz);
     iocPtr = (struct PartnerInfo *)buff;  
     iocPtr->PI_BufLen  = bufsiz;  
     iocPtr->PI_Version = PI_VERSION_1;   
     iocPtr->PI_ReqType = PI_REQTYPE_PARTNER_USERID 
                          + PI_REQTYPE_PARTNER_UTOKEN;   
     iocPtr->PI_TimeOut = PI_TIMEOUT_MINIMUM;   

     rc = w_ioctl(s,    
                  SIOCGPARTNERINFO,   
                  iocPtr->PI_BufLen,   
                  (char *)iocPtr);    
   }

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014