def DNSServiceRegister(flags=0, interfaceIndex=kDNSServiceInterfaceIndexAny, name=None, regtype=_NO_DEFAULT, domain=None, host=None, port=_NO_DEFAULT, txtRecord='', callBack=None):
 _NO_DEFAULT.check(regtype)
 _NO_DEFAULT.check(port)
 port = socket.htons(port)
 if (not txtRecord):
  (txtLen, txtRecord) = (1, '\x00')
 else:
  (txtLen, txtRecord) = _string_to_length_and_void_p(txtRecord)
 @_DNSServiceRegisterReply
 def _callback(sdRef, flags, errorCode, name, regtype, domain, context):
  if (callBack is not None):
   callBack(sdRef, flags, errorCode, name.decode(), regtype.decode(), domain.decode())
 _global_lock.acquire()
 try:
  sdRef = _DNSServiceRegister(flags, interfaceIndex, name, regtype, domain, host, port, txtLen, txtRecord, _callback, None)
 finally:
  _global_lock.release()
 sdRef._add_callback(_callback)
 return sdRef

def DNSServiceRegister ( flags = 0 , interfaceIndex = kDNSServiceInterfaceIndexAny , name = None , regtype = _NO_DEFAULT , domain = None , host = None , port = _NO_DEFAULT , txtRecord = '' , callBack = None ) : _NO_DEFAULT . check ( regtype ) _NO_DEFAULT . check ( port ) port = socket . htons ( port ) if ( not txtRecord ) : ( txtLen , txtRecord ) = ( 1 , '\x00' ) else : ( txtLen , txtRecord ) = _string_to_length_and_void_p ( txtRecord ) @ _DNSServiceRegisterReply def _callback ( sdRef , flags , errorCode , name , regtype , domain , context ) : if ( callBack is not None ) : callBack ( sdRef , flags , errorCode , name . decode ( ) , regtype . decode ( ) , domain . decode ( ) ) _global_lock . acquire ( ) try : sdRef = _DNSServiceRegister ( flags , interfaceIndex , name , regtype , domain , host , port , txtLen , txtRecord , _callback , None ) finally : _global_lock . release ( ) sdRef . _add_callback ( _callback ) return sdRef
register a service that is discovered via dnsservicebrowse() and dnsserviceresolve() calls .