]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - backend/snmp.c
Update ipp documentation to reflect the behavior of configuring WiFi on IPP USB printers.
[thirdparty/cups.git] / backend / snmp.c
index 688997b78e6c20e41090e3ee3fa5f82decb960aa..084c6f5118a28388c31000c68b6741ba40c38455 100644 (file)
@@ -1,18 +1,11 @@
 /*
- * "$Id$"
- *
  * SNMP discovery backend for CUPS.
  *
- * Copyright 2007-2014 by Apple Inc.
- * Copyright 2006-2007 by Easy Software Products, all rights reserved.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
- * "LICENSE" which should have been included with this file.  If this
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * Copyright © 2007-2014 by Apple Inc.
+ * Copyright © 2006-2007 by Easy Software Products, all rights reserved.
  *
- * This file is subject to the Apple OS-Developed Software exception.
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more
+ * information.
  */
 
 /*
@@ -161,6 +154,8 @@ static const int    UriOID[] = { CUPS_OID_ppmPortServiceNameOrURI, 1, 1, -1 };
 static const int       LexmarkProductOID[] = { 1,3,6,1,4,1,641,2,1,2,1,2,1,-1 };
 static const int       LexmarkProductOID2[] = { 1,3,6,1,4,1,674,10898,100,2,1,2,1,2,1,-1 };
 static const int       LexmarkDeviceIdOID[] = { 1,3,6,1,4,1,641,2,1,2,1,3,1,-1 };
+static const int       HPDeviceIdOID[] = { 1,3,6,1,4,1,11,2,3,9,1,1,7,0,-1 };
+static const int       RicohDeviceIdOID[] = { 1,3,6,1,4,1,367,3,2,1,1,1,11,0,-1 };
 static const int       XeroxProductOID[] = { 1,3,6,1,4,1,128,2,1,3,1,2,0,-1 };
 static cups_array_t    *DeviceURIs = NULL;
 static int             HostNameLookups = 0;
@@ -429,7 +424,7 @@ alarm_handler(int sig)                      /* I - Signal number */
 #endif /* !HAVE_SIGSET && !HAVE_SIGACTION */
 
   if (DebugLevel)
-    write(2, "DEBUG: ALARM!\n", 14);
+    backendMessage("DEBUG: ALARM!\n");
 }
 
 
@@ -506,17 +501,16 @@ fix_make_model(
     make_model[0] = 'H';
     make_model[1] = 'P';
     make_model[2] = ' ';
-    strlcpy(make_model + 3, mmptr, make_model_size - 3);
+    strlcpy(make_model + 3, mmptr, (size_t)make_model_size - 3);
   }
   else if (!_cups_strncasecmp(old_make_model, "deskjet", 7))
-    snprintf(make_model, make_model_size, "HP DeskJet%s", old_make_model + 7);
+    snprintf(make_model, (size_t)make_model_size, "HP DeskJet%s", old_make_model + 7);
   else if (!_cups_strncasecmp(old_make_model, "officejet", 9))
-    snprintf(make_model, make_model_size, "HP OfficeJet%s", old_make_model + 9);
+    snprintf(make_model, (size_t)make_model_size, "HP OfficeJet%s", old_make_model + 9);
   else if (!_cups_strncasecmp(old_make_model, "stylus_pro_", 11))
-    snprintf(make_model, make_model_size, "EPSON Stylus Pro %s",
-             old_make_model + 11);
+    snprintf(make_model, (size_t)make_model_size, "EPSON Stylus Pro %s", old_make_model + 11);
   else
-    strlcpy(make_model, old_make_model, make_model_size);
+    strlcpy(make_model, old_make_model, (size_t)make_model_size);
 
   if ((mmptr = strstr(make_model, ", Inc.,")) != NULL)
   {
@@ -977,9 +971,15 @@ read_snmp_response(int fd)         /* I - SNMP socket file descriptor */
        _cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1,
                       packet.community, CUPS_ASN1_GET_REQUEST,
                       DEVICE_ID, LexmarkDeviceIdOID);
+       _cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1,
+                      packet.community, CUPS_ASN1_GET_REQUEST,
+                      DEVICE_ID, RicohDeviceIdOID);
        _cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1,
                       packet.community, CUPS_ASN1_GET_REQUEST,
                       DEVICE_PRODUCT, XeroxProductOID);
+       _cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1,
+                      packet.community, CUPS_ASN1_GET_REQUEST,
+                      DEVICE_ID, HPDeviceIdOID);
         break;
 
     case DEVICE_DESCRIPTION :
@@ -1362,8 +1362,3 @@ update_cache(snmp_cache_t *device,        /* I - Device */
 
   list_device(device);
 }
-
-
-/*
- * End of "$Id$".
- */