home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl502b.zip / ext / DPI / DPI.xs < prev    next >
Text File  |  1996-02-23  |  4KB  |  208 lines

  1. #include "EXTERN.h"
  2. #include "perl.h"
  3. #include "XSUB.h"
  4.  
  5. #undef SNMP_DPI_VERSION
  6. #undef SNMP_DPI_RELEASE
  7. #define SNMP_DPI_VERSION 2
  8. #define SNMP_DPI_RELEASE 0
  9.  
  10. #include "snmp_dpi.h"
  11. #include "dpiconst.h"
  12.  
  13. typedef struct {
  14.         STRLEN    len;
  15.         void *    ptr;
  16. } DPIString;
  17.  
  18. typedef unsigned char *    DPIPacket;
  19. typedef void *        DPIPointer;
  20.  
  21. static int
  22. not_here(char *s)
  23. {
  24.     croak("%s not implemented on this architecture", s);
  25.     return -1;
  26. }
  27.  
  28. static long
  29. constant(name, arg)
  30. char *name;
  31. int arg;
  32. {
  33.     const struct DpiConst *p = in_word_set(name, strlen(name));
  34.     if (p) {
  35.         errno = 0;
  36.         return p->val;
  37.     }
  38.     errno = ENOENT;
  39.     return 0;
  40. }
  41.  
  42.  
  43. MODULE = DPI        PACKAGE = DPI
  44.  
  45.  
  46. double
  47. constant(name,arg)
  48.     char *        name
  49.     int        arg
  50.  
  51. int
  52. DPIawait_packet_from_agent(handle,timeout,message)
  53.     int        handle
  54.     int        timeout
  55.     DPIString    message = NO_INIT
  56.     CODE:
  57.     RETVAL = DPIawait_packet_from_agent(handle,timeout,
  58.         (unsigned char **)&message.ptr,(unsigned long *)&message.len);
  59.     OUTPUT:
  60.     RETVAL
  61.     message
  62.  
  63. int
  64. DPIconnect_to_agent_NMQ(t_qname,s_qname)
  65.     char *        t_qname
  66.     char *        s_qname
  67.  
  68. int
  69. DPIconnect_to_agent_TCP(hostname,community)
  70.     char *        hostname
  71.     char *        community
  72.  
  73. int
  74. DPIconnect_to_agent_UDP(hostname,community)
  75.     char *        hostname
  76.     char *        community
  77.  
  78. void
  79. DPIdisconnect_from_agent(handle)
  80.     int        handle
  81.  
  82. int
  83. DPIsend_packet_to_agent(handle,message)
  84.     int        handle
  85.     DPIString    message
  86.     CODE:
  87.     RETVAL = DPIsend_packet_to_agent(handle,message.ptr,message.len);
  88.     OUTPUT:
  89.     RETVAL
  90.     message
  91.  
  92. int
  93. lookup_host(hostname)
  94.     char *        hostname
  95.  
  96. int
  97. query_DPI_port(hostname,community,porttype=dpiPortForTCP)
  98.     char *        hostname
  99.     char *        community
  100.     int        porttype
  101.  
  102. void
  103. DPIdebug(level=0)
  104.     int        level
  105.  
  106. void
  107. fDPIparse(hdr)
  108.     DPIPointer    hdr
  109.  
  110. void
  111. fDPIset(packet)
  112.     DPIPointer    packet
  113.  
  114. DPIPacket
  115. mkDPIAreYouThere()
  116.  
  117. # DPIPacket
  118. # mkDPIbulk(non_repeaters,max_repetitions,packet)
  119. #    long        non_repeaters
  120. #    long        max_repetitions
  121. #    DPIPointer    packet
  122.  
  123. DPIPacket
  124. mkDPIclose(reason_code)
  125.     short        reason_code
  126.  
  127. DPIPointer
  128. mkDPIget(packet,group,instance)
  129.     DPIPointer    packet
  130.     char *        group
  131.     char *        instance
  132.  
  133. DPIPointer
  134. mkDPIhdr(type)
  135.     int        type
  136.  
  137. DPIPointer
  138. mkDPIhdr_version(type,version,release)
  139.     int        type
  140.     short        version
  141.     short        release
  142.  
  143. DPIPointer
  144. mkDPInext(packet,group,instance)
  145.     DPIPointer    packet
  146.     char *        group
  147.     char *        instance
  148.  
  149. DPIPacket
  150. mkDPIopen(oid,description,timeout,max_varBinds,character_set,password)
  151.     char *        oid
  152.     char *        description
  153.     unsigned long    timeout
  154.     unsigned long    max_varBinds
  155.     short        character_set
  156.     DPIString    password
  157.     CODE:
  158.     RETVAL = mkDPIopen(oid,description,timeout,max_varBinds,character_set,
  159.             password.len,password.ptr);
  160.     OUTPUT:
  161.     RETVAL
  162.  
  163. DPIPacket
  164. mkDPIpacket(hdr)
  165.     DPIPointer    hdr
  166.  
  167. DPIPacket
  168. mkDPIregister(timeout,priority,group,bulk_select)
  169.     unsigned short    timeout
  170.     long        priority
  171.     char *        group
  172.     short        bulk_select
  173.  
  174. DPIPacket
  175. mkDPIresponse(hdr,error_code,error_index,packet)
  176.     DPIPointer    hdr
  177.     long        error_code
  178.     long        error_index
  179.     DPIPointer    packet
  180.  
  181. DPIPointer
  182. mkDPIset(packet,group,instance,type,value)
  183.     DPIPointer    packet
  184.     char *        group
  185.     char *        instance
  186.     int        type
  187.     DPIString    value
  188.     CODE:
  189.     RETVAL = mkDPIset(packet,group,instance,type,value.len,value.ptr);
  190.     OUTPUT:
  191.     RETVAL
  192.  
  193. DPIPacket
  194. mkDPItrap(generic,specific,packet=NULL,enterprise=NULL)
  195.     long        generic
  196.     long        specific
  197.     DPIPointer    packet
  198.     char *        enterprise
  199.  
  200. DPIPacket
  201. mkDPIunregister(reason_code,group)
  202.     short        reason_code
  203.     char *        group
  204.  
  205. DPIPointer
  206. pDPIpacket(packet)
  207.     DPIPointer    packet
  208.