Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should be able to specify different registration & browsing protocols #877

Closed
michaelrsweet opened this Issue Sep 3, 2004 · 3 comments

Comments

Projects
None yet
1 participant
@michaelrsweet
Copy link
Collaborator

michaelrsweet commented Sep 3, 2004

Version: 1.2-feature
CUPS.org User: jlovell

It would be nice if we could specify different queue registration & browsing protocols. This will allow us to register with the upcoming mDNS protocol support without having to browse with it.

The attached patch accomplishes this by supplanting the BrowseProtocols directive with BrowseLocalProtocols and BrowseRemoteProtocols.

Thanks!

@michaelrsweet

This comment has been minimized.

Copy link
Collaborator Author

michaelrsweet commented Sep 6, 2004

CUPS.org User: mike

Thanks, reassigned to 1.2 for application there...

@michaelrsweet

This comment has been minimized.

Copy link
Collaborator Author

michaelrsweet commented Sep 18, 2005

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet

This comment has been minimized.

Copy link
Collaborator Author

michaelrsweet commented Sep 18, 2005

"browse_protocols.patch":

? autom4te.cache
? browse_protocols.patch
? conf/pam.std

Index: conf/cupsd.conf.in

RCS file: /home/anoncvs/cups/conf/cupsd.conf.in,v
retrieving revision 1.16
diff -u -d -b -w -r1.16 cupsd.conf.in
--- conf/cupsd.conf.in 18 Aug 2004 17:53:47 -0000 1.16
+++ conf/cupsd.conf.in 3 Sep 2004 18:12:29 -0000
@@ -490,15 +490,15 @@
#Browsing On

-# BrowseProtocols: which protocols to use for browsing. Can be
-# any of the following separated by whitespace and/or commas:
+# BrowseProtocols: which protocols to use for browsing. This
+# directive is shorthand for setting BrowseLocalProtocols and
+# BrowseRemoteProtocols to the specified value. Can be any
+# of the following separated by whitespace and/or commas:

all - Use all supported protocols.

cups - Use the CUPS browse protocol.

slp - Use the SLPv2 protocol.

-# The default is "cups".
-#

NOTE: If you choose to use SLPv2, it is strongly recommended that

you have at least one SLP Directory Agent (DA) on your

network. Otherwise, browse updates can take several seconds,

@@ -509,6 +509,23 @@
#BrowseProtocols cups

+# BrowseLocalProtocols: controls the sending/registration of local
+# printers. Can be any of the protocols listed in BrowseProtocols.
+#
+# The default is "@CUPS_DEFAULT_BROWSELOCALPROTOCOLS@".
+
+#BrowseLocalProtocols @CUPS_DEFAULT_BROWSELOCALPROTOCOLS@
+
+#
+# BrowseRemoteProtocols: controls the receipt/discovery/listening
+# for remote printers. Can be any of the protocols listed in
+# BrowseProtocols.
+#
+# The default is "cups".
+
+#BrowseRemoteProtocols cups
+
+#

BrowseAddress: specifies a broadcast address to be used. By

default browsing information is not sent!

Index: man/cupsd.conf.man

RCS file: /home/anoncvs/cups/man/cupsd.conf.man,v
retrieving revision 1.14
diff -u -d -b -w -r1.14 cupsd.conf.man
--- man/cupsd.conf.man 18 Aug 2004 17:57:52 -0000 1.14
+++ man/cupsd.conf.man 3 Sep 2004 18:12:29 -0000
@@ -91,7 +91,16 @@
.TP 5
BrowseProtocols
.br
-Specifies the protocols to use for printer browsing.
+Specifies the protocols to use for printer registration and discovery. Using BrowseProtocols sets
+the BrowseLocalProtocols and BrowseRemoteProtocols directives to the specified value.
+.TP 5
+BrowseLocalProtocols
+.br
+Specifies the protocols to use for the sending or registration of local printers.
+.TP 5
+BrowseRemoteProtocols
+.br
+Specifies the protocols to use for printer discovery of remote printers.
.TP 5
BrowseRelay
.br

Index: scheduler/conf.c

RCS file: /home/anoncvs/cups/scheduler/conf.c,v
retrieving revision 1.151
diff -u -d -b -w -r1.151 conf.c
--- scheduler/conf.c 23 Aug 2004 18:00:59 -0000 1.151
+++ scheduler/conf.c 3 Sep 2004 18:12:30 -0000
@@ -363,7 +363,8 @@

BrowseInterval = DEFAULT_INTERVAL;
BrowsePort = ippPort();

  • BrowseProtocols = BROWSE_CUPS;

  • BrowseLocalProtocols= BROWSE_CUPS;

  • BrowseRemoteProtocols= BROWSE_CUPS;
    BrowseShortNames = TRUE;
    BrowseTimeout = DEFAULT_TIMEOUT;
    Browsing = TRUE;
    @@ -734,6 +735,7 @@
    nameptr, / Pointer into name /
    *value; /
    Pointer to value /
    int valuelen; /
    Length of value */

  • int browseProtocols; /* Browse protocol /
    var_t *var; /
    Current variable /
    unsigned address, /
    Address value /
    netmask; /
    Netmask value */
    @@ -1003,13 +1005,17 @@
    LogMessage(L_ERROR, "Unknown BrowseOrder value %s on line %d.",
    value, linenum);
    }

  • else if (strcasecmp(name, "BrowseProtocols") == 0)

  • else if (strcasecmp(name, "BrowseProtocols") == 0 ||

  •    strcasecmp(name, "BrowseLocalProtocols") == 0 ||
    
  •    strcasecmp(name, "BrowseRemoteProtocols") == 0)
    

    {
    /*

    • "BrowseProtocol name [... name]"
  •  \* "BrowseLocalProtocols name [... name]"
    
  •  * "BrowseRemoteProtocols   name [... name]"
    

    */

  •  BrowseProtocols = 0;
    
  •  browseProtocols = 0;
    

    for (; *value;)
    {
    @@ -1024,13 +1030,13 @@
    }

     if (strcasecmp(value, "cups") == 0)
    
  • BrowseProtocols |= BROWSE_CUPS;
    
  • browseProtocols |= BROWSE_CUPS;
     else if (strcasecmp(value, "slp") == 0)
    
  • BrowseProtocols |= BROWSE_SLP;
    
  • browseProtocols |= BROWSE_SLP;
     else if (strcasecmp(value, "ldap") == 0)
    
  • BrowseProtocols |= BROWSE_LDAP;
    
  • browseProtocols |= BROWSE_LDAP;
     else if (strcasecmp(value, "all") == 0)
    
  • BrowseProtocols |= BROWSE_ALL;
    
  • browseProtocols |= BROWSE_ALL;
    

    else
    {
    LogMessage(L_ERROR, "Unknown browse protocol "%s" on line %d.",
    @@ -1042,6 +1048,13 @@
    if (!isspace(*value) || *value != ',')
    break;
    }
    +

  •  if (strcasecmp(name, "BrowseProtocols") == 0)
    
  • BrowseLocalProtocols = BrowseRemoteProtocols = browseProtocols;

  •  else if (strcasecmp(name, "BrowseLocalProtocols") == 0)
    
  • BrowseLocalProtocols = browseProtocols;

  •  else
    
  • BrowseRemoteProtocols = browseProtocols;
    }
    else if (strcasecmp(name, "BrowseAllow") == 0 ||
    strcasecmp(name, "BrowseDeny") == 0)

Index: scheduler/dirsvc.c

RCS file: /home/anoncvs/cups/scheduler/dirsvc.c,v
retrieving revision 1.136
diff -u -d -b -w -r1.136 dirsvc.c
--- scheduler/dirsvc.c 23 Aug 2004 18:42:52 -0000 1.136
+++ scheduler/dirsvc.c 3 Sep 2004 18:12:30 -0000
@@ -518,7 +518,7 @@
to; /* Timeout time */

  • if (!Browsing || !BrowseProtocols)
  • if (!Browsing || !BrowseLocalProtocols)
    return;

/*
@@ -577,11 +577,11 @@

p->browse_time = time(NULL);

  • if (BrowseProtocols & BROWSE_CUPS)
  • if (BrowseLocalProtocols & BROWSE_CUPS)
    SendCUPSBrowse(p);

#ifdef HAVE_LIBSLP

  • if (BrowseProtocols & BROWSE_SLP)
  • if (BrowseLocalProtocols & BROWSE_SLP)
    SendSLPBrowse(p);
    #endif /* HAVE_LIBSLP /
    }
    @@ -771,10 +771,10 @@
    struct sockaddr_in addr; /
    Broadcast address */
  • if (!Browsing || !BrowseProtocols)
  • if (!Browsing || !(BrowseLocalProtocols | BrowseRemoteProtocols))
    return;
  • if (BrowseProtocols & BROWSE_CUPS)
  • if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_CUPS)
    {
    /*
  • Create the broadcast socket...
    @@ -784,7 +784,8 @@
    {
    LogMessage(L_ERROR, "StartBrowsing: Unable to create broadcast socket - %s.",
    strerror(errno));
  •  BrowseProtocols &= ~BROWSE_CUPS;
    
  •  BrowseLocalProtocols  &= ~BROWSE_CUPS;
    
  •  BrowseRemoteProtocols &= ~BROWSE_CUPS;
    
    return;
    }

@@ -805,7 +806,8 @@
#endif /* WIN32 */

   BrowseSocket    = -1;
  •  BrowseProtocols &= ~BROWSE_CUPS;
    
  •  BrowseLocalProtocols  &= ~BROWSE_CUPS;
    
  •  BrowseRemoteProtocols &= ~BROWSE_CUPS;
    
    return;
    }

@@ -830,7 +832,8 @@
#endif /* WIN32 */

   BrowseSocket    = -1;
  •  BrowseProtocols &= ~BROWSE_CUPS;
    
  •  BrowseLocalProtocols  &= ~BROWSE_CUPS;
    
  •  BrowseRemoteProtocols &= ~BROWSE_CUPS;
    
    return;
    }

@@ -847,7 +850,7 @@
BrowseSocket = -1;

#ifdef HAVE_LIBSLP

  • if (BrowseProtocols & BROWSE_SLP)

  • if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP)
    {
    /*

  • Open SLP handle...
    @@ -856,7 +859,8 @@
    if (SLPOpen("en", SLP_FALSE, &BrowseSLPHandle) != SLP_OK)
    {
    LogMessage(L_ERROR, "Unable to open an SLP handle; disabling SLP browsing!");

  •  BrowseProtocols &= ~BROWSE_SLP;
    
  •  BrowseLocalProtocols  &= ~BROWSE_SLP;
    
  •  BrowseRemoteProtocols &= ~BROWSE_SLP;
    

    }

    BrowseSLPRefresh = 0;
    @@ -1049,10 +1053,10 @@
    void
    StopBrowsing(void)
    {

  • if (!Browsing || !BrowseProtocols)

  • if (!Browsing || !(BrowseLocalProtocols | BrowseRemoteProtocols))
    return;

  • if (BrowseProtocols & BROWSE_CUPS)

  • if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_CUPS)
    {
    /*

  • Close the socket and remove it from the input selection set.
    @@ -1075,7 +1079,7 @@
    }

#ifdef HAVE_LIBSLP

  • if (BrowseProtocols & BROWSE_SLP)
  • if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP)
    {
    /*
  • Close SLP handle...
    Index: scheduler/dirsvc.h

    RCS file: /home/anoncvs/cups/scheduler/dirsvc.h,v
    retrieving revision 1.22
    diff -u -d -b -w -r1.22 dirsvc.h
    --- scheduler/dirsvc.h 23 Aug 2004 18:00:59 -0000 1.22
    +++ scheduler/dirsvc.h 3 Sep 2004 18:12:30 -0000
    @@ -82,8 +82,10 @@

VAR int Browsing VALUE(TRUE),
/* Whether or not browsing is enabled */

  •       BrowseProtocols VALUE(BROWSE_ALL),
    
  •               /\* Protocols to support */
    
  •       BrowseLocalProtocols    VALUE(BROWSE_ALL),
    
  •               /\* Register protocols to support */
    
  •       BrowseRemoteProtocols   VALUE(BROWSE_ALL),
    
  •               /* Listen protocols to support */
        BrowseShortNames VALUE(TRUE),
                /* Short names for remote printers? */
        BrowseSocket    VALUE(-1),
    

    Index: scheduler/main.c

    RCS file: /home/anoncvs/cups/scheduler/main.c,v
    retrieving revision 1.123
    diff -u -d -b -w -r1.123 main.c
    --- scheduler/main.c 23 Aug 2004 18:36:50 -0000 1.123
    +++ scheduler/main.c 3 Sep 2004 18:12:30 -0000
    @@ -683,7 +683,7 @@

    • Update the browse list as needed...
      */
  • if (Browsing && BrowseProtocols)

  • if (Browsing && BrowseRemoteProtocols)
    {
    if (BrowseSocket >= 0 && FD_ISSET(BrowseSocket, input))
    UpdateCUPSBrowse();
    @@ -692,7 +692,7 @@
    UpdatePolling();

#ifdef HAVE_LIBSLP

  •  if ((BrowseProtocols & BROWSE_SLP) && BrowseSLPRefresh <= time(NULL))
    
  •  if ((BrowseRemoteProtocols & BROWSE_SLP) && BrowseSLPRefresh <= time(NULL))
     UpdateSLPBrowse();
    
    #endif /* HAVE_LIBSLP */

@@ -1202,17 +1202,17 @@

  • Update the browse list as needed...
    */
  • if (Browsing && BrowseProtocols)
  • if (Browsing && (BrowseLocalProtocols || BrowseRemoteProtocols))
    {
    #ifdef HAVE_LIBSLP
  • if ((BrowseProtocols & BROWSE_SLP) && (BrowseSLPRefresh < timeout))
  • if ((BrowseRemoteProtocols & BROWSE_SLP) && (BrowseSLPRefresh < timeout))
    {
    timeout = BrowseSLPRefresh;
    why = "update SLP browsing";
    }
    #endif /* HAVE_LIBSLP */
  • if (BrowseProtocols & BROWSE_CUPS)
  • if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_CUPS)
    {
    for (p = Printers; p != NULL; p = p->next)
    {

@michaelrsweet michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.