]> granicus.if.org Git - php/commitdiff
- Nuke unused file
authorJani Taskinen <jani@php.net>
Fri, 21 Nov 2008 16:37:49 +0000 (16:37 +0000)
committerJani Taskinen <jani@php.net>
Fri, 21 Nov 2008 16:37:49 +0000 (16:37 +0000)
ext/snmp/winsnmp.c [deleted file]
win32/php5dll.dsp
win32/php5dllts.dsp

diff --git a/ext/snmp/winsnmp.c b/ext/snmp/winsnmp.c
deleted file mode 100644 (file)
index 508dc06..0000000
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
-Created from the snmputil sample in the Microsoft SDK for NT
-*/
-
-#include "php.h"
-#if COMPILE_DL
-#include "../phpdl.h"
-#include "functions/dl.h"
-#endif
-#include "php_snmp.h"
-#include <sys/types.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <malloc.h>
-
-#if HAVE_SNMP
-
-#include <snmp.h>
-#include <mgmtapi.h>
-
-/* {{{ snmp_functions[]
- */
-const zend_function_entry snmp_functions[] = {
-    {"snmpget", php3_snmpget, NULL},
-    {"snmpwalk", php3_snmpwalk, NULL},
-    {NULL,NULL,NULL}
-};
-/* }}} */
-
-/* {{{ snmp_module_entry
- */
-zend_module_entry snmp_module_entry = {
-       STANDARD_MODULE_HEADER,
-       "SNMP",
-    snmp_functions,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NO_VERSION_YET,
-    STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#if COMPILE_DL
-DLEXPORT zend_module_entry *get_module() { return &snmp_module_entry; }
-#endif
-
-#define GET     1
-#define WALK    2
-#define GETNEXT 3
-
-#define TIMEOUT 6000 /* milliseconds */
-#define RETRIES 3
-
-/* {{{ _php_snmp
- */
-void _php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st)
-{
-       INT operation;
-
-       RFC1157VarBindList variableBindings;
-       LPSNMP_MGR_SESSION session;
-
-       char *agent, *community, *object_id;
-       int agent_len, community_len, object_id_len;
-
-       INT timeout = TIMEOUT;
-       INT retries = RETRIES;
-
-       BYTE requestType;
-       AsnInteger errorStatus;
-       AsnInteger errorIndex;
-       AsnObjectIdentifier oid;
-
-       char *chkPtr = NULL;
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &agent, &agent_len, &community, &community_len, &object_id, &object_id_len) == FAILURE) {
-                return;
-       }
-
-       operation = st;
-       SnmpMgrStrToOid(object_id, &oid);
-
-/* 
-   I've limited this to only one oid, but we can create a
-   list of oid's here, and expand the function to take multiple
-   oid's
-*/
-    variableBindings.list->name = oid; 
-    variableBindings.list->value.asnType = ASN_NULL;
-    variableBindings.len = 1;
-
-/* Establish a SNMP session to communicate with the remote agent.  The
-   community, communications timeout, and communications retry count
-   for the session are also required.
-*/
-       if ((session = SnmpMgrOpen(agent, community, timeout, retries)) == NULL){
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "error on SnmpMgrOpen %d", GetLastError());
-       }
-
-    /* Determine and perform the requested operation.*/
-    if (operation == GET || operation == GETNEXT){
-        /* Get and GetNext are relatively simple operations to perform.
-           Simply initiate the request and process the result and/or
-           possible error conditions. */
-
-        if (operation == GET){
-            requestType = ASN_RFC1157_GETREQUEST;
-               } else {
-            requestType = ASN_RFC1157_GETNEXTREQUEST;
-               }
-
-        /* Request that the API carry out the desired operation.*/
-               if (!SnmpMgrRequest(session, requestType, &variableBindings,
-                            &errorStatus, &errorIndex)){
-            /* The API is indicating an error. */
-            php_error_docref(NULL TSRMLS_CC, E_WARNING, "error on SnmpMgrRequest %d", GetLastError());
-        } else {
-            /* The API succeeded, errors may be indicated from the remote
-               agent. */
-            if (errorStatus > 0){
-                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error: errorStatus=%d, errorIndex=%d",
-                       errorStatus, errorIndex);
-            } else {
-                /* Display the resulting variable bindings.*/
-                               UINT i;
-                char *str = NULL;
-
-                for(i=0; i < variableBindings.len; i++)
-                    {
-                    SnmpMgrOidToStr(&variableBindings.list[i].name, &str);
-                    php_printf("Variable = %s\n", str);
-                    if (str) SNMP_free(str);
-
-                    php_printf("Value    = ");
-                    SnmpUtilPrintAsnAny(&variableBindings.list[i].value);
-
-                    php_printf("\n");
-                    } /* end for() */
-                }
-            }
-
-        /* Free the variable bindings that have been allocated.*/
-        SnmpUtilVarBindListFree(&variableBindings);
-        }
-    else if (operation == WALK)
-        {
-        /* Walk is a common term used to indicate that all MIB variables
-           under a given OID are to be traversed and displayed.  This is
-           a more complex operation requiring tests and looping in addition
-           to the steps for get/getnext above. */
-        AsnObjectIdentifier root;
-        AsnObjectIdentifier tempOid;
-
-        SnmpUtilOidCpy(&root, &variableBindings.list[0].name);
-        requestType = ASN_RFC1157_GETNEXTREQUEST;
-
-        while(1)
-            {
-            if (!SnmpMgrRequest(session, requestType, &variableBindings,
-                                &errorStatus, &errorIndex)){
-                /* The API is indicating an error.*/
-                php_error_docref(NULL TSRMLS_CC, E_WARNING, "error on SnmpMgrRequest %d", GetLastError());
-                break;
-                }
-            else
-                {
-                /* The API succeeded, errors may be indicated from the remote
-                   agent.
-                   Test for end of subtree or end of MIB. */
-                if (errorStatus == SNMP_ERRORSTATUS_NOSUCHNAME ||
-                    SnmpUtilOidNCmp(&variableBindings.list[0].name,
-                                    &root, root.idLength))
-                    {
-                    PUTS("End of MIB subtree.\n\n");
-                    break;
-                    }
-
-                /* Test for general error conditions or sucesss. */
-                if (errorStatus > 0){
-                    php_error_docref(NULL TSRMLS_CC, E_ERROR,"Error: errorStatus=%d, errorIndex=%d", errorStatus, errorIndex);
-                    break;
-                    }
-                else
-                    {
-                    /* Display resulting variable binding for this iteration. */
-                    char *str = NULL;
-
-                    SnmpMgrOidToStr(&variableBindings.list[0].name, &str);
-                    php_printf("Variable = %s\n", str);
-                    if (str) SNMP_free(str);
-
-                    php_printf("Value    = ");
-                    SnmpUtilPrintAsnAny(&variableBindings.list[0].value);
-
-                    php_printf("\n");
-                    }
-                } /* end if () */
-            /* Prepare for the next iteration.  Make sure returned oid is
-               preserved and the returned value is freed.
-                       */
-            SnmpUtilOidCpy(&tempOid, &variableBindings.list[0].name);
-            SnmpUtilVarBindFree(&variableBindings.list[0]);
-            SnmpUtilOidCpy(&variableBindings.list[0].name, &tempOid);
-            variableBindings.list[0].value.asnType = ASN_NULL;
-            SnmpUtilOidFree(&tempOid);
-            } /* end while() */
-        /* Free the variable bindings that have been allocated.*/
-        SnmpUtilVarBindListFree(&variableBindings);
-        SnmpUtilOidFree(&root);
-       } /* end if (operation) */
-
-
-       /* Close SNMP session with the remote agent.*/
-       if (!SnmpMgrClose(session)){
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "error on SnmpMgrClose %d", GetLastError());
-       }
-}
-/* }}} */
-
-/* {{{ php3_snmpget
- */
-DLEXPORT void php3_snmpget(INTERNAL_FUNCTION_PARAMETERS) {
-       _php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ php3_snmpwalk
- */
-DLEXPORT void php3_snmpwalk(INTERNAL_FUNCTION_PARAMETERS) {
-       _php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,2);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */
index 9a3bfd57d5cbcd56521922c36e5f60db659d5829..4abe94671c40e646641fdf9eb19fbbf7d04212ee 100644 (file)
@@ -1564,10 +1564,6 @@ SOURCE=..\win32\wfile.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\ext\snmp\winsnmp.c\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=..\win32\winutil.c\r
 # End Source File\r
 # Begin Source File\r
index 620ba54bbd6aa1002064708280c457680893239b..4aae50f159b5473cc3a643a061bccd26c5842533 100644 (file)
@@ -2056,10 +2056,6 @@ SOURCE=..\win32\wfile.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\ext\snmp\winsnmp.c\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=..\win32\winutil.c\r
 # End Source File\r
 # Begin Source File\r