41     """ Keeps track of how many times a client has requested to advertise 
   44     A client could advertise and unadvertise a topic multiple times, and we 
   45     must make sure that the underlying publisher is only created and destroyed 
   46     at the appropriate moments 
   61         manager.register(self.
client_id, self.
topic, msg_type, latch=latch, queue_size=queue_size)
 
   77     advertise_msg_fields = [(
True, 
"topic", string_types), (
True, 
"type", string_types)]
 
   78     unadvertise_msg_fields = [(
True, 
"topic", string_types)]
 
   84         Capability.__init__(self, protocol)
 
   87         protocol.register_operation(
"advertise", self.
advertise)
 
   88         protocol.register_operation(
"unadvertise", self.
unadvertise)
 
   93         if protocol.parameters 
and "unregister_timeout" in protocol.parameters:
 
   94             manager.unregister_timeout = protocol.parameters.get(
"unregister_timeout")
 
   98         aid = message.get(
"id", 
None)
 
  101         topic = message[
"topic"]
 
  102         msg_type = message[
"type"]
 
  103         latch = message.get(
"latch", 
False)
 
  104         queue_size = message.get(
"queue_size", 100)
 
  106         if Advertise.topics_glob 
is not None and Advertise.topics_glob:
 
  107             self.
protocol.log(
"debug", 
"Topic security glob enabled, checking topic: " + topic)
 
  109             for glob 
in Advertise.topics_glob:
 
  110                 if (fnmatch.fnmatch(topic, glob)):
 
  111                     self.
protocol.log(
"debug", 
"Found match with glob " + glob + 
", continuing advertisement...")
 
  115                 self.
protocol.log(
"warn", 
"No match found for topic, cancelling advertisement of: " + topic)
 
  118             self.
protocol.log(
"debug", 
"No topic security glob, not checking advertisement.")
 
  126         self.
_registrations[topic].register_advertisement(msg_type, aid, latch, queue_size)
 
  130         aid = message.get(
"id", 
None)
 
  133         topic = message[
"topic"]
 
  135         if Advertise.topics_glob 
is not None and Advertise.topics_glob:
 
  136             self.
protocol.log(
"debug", 
"Topic security glob enabled, checking topic: " + topic)
 
  138             for glob 
in Advertise.topics_glob:
 
  139                 if (fnmatch.fnmatch(topic, glob)):
 
  140                     self.
protocol.log(
"debug", 
"Found match with glob " + glob + 
", continuing unadvertisement...")
 
  144                 self.
protocol.log(
"warn", 
"No match found for topic, cancelling unadvertisement of: " + topic)
 
  147             self.
protocol.log(
"debug", 
"No topic security glob, not checking unadvertisement.")
 
  161             registration.unregister()
 
  163         self.
protocol.unregister_operation(
"advertise")
 
  164         self.
protocol.unregister_operation(
"unadvertise")