Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(9)  |  Call(6)  |  Derive(0)  |  Import(3)
Compares the both given hostnames (DNS names or IPs) and
returns True if they are equal (except DNS aliases), False otherwise.

        def compareHostNames(name1, name2):
	"""Compares the both given hostnames (DNS names or IPs) and
	returns True if they are equal (except DNS aliases), False otherwise.
	"""
	#FIXME IPs of aliases could be detected as not equal
	# the result lists should be compared each one by one
	if (name1 is None) or (name2 is None):
		return False
	try:
		list1 = socket.getaddrinfo(name1, 0, socket.AF_UNSPEC)
		ip1 = list1[0][4][0]
	except socket.gaierror:
		ip1 = name1
	try:
		list2 = socket.getaddrinfo(name2, 0, socket.AF_UNSPEC)
		ip2 = list2[0][4][0]
	except socket.gaierror:
		ip2 = name2
	if ip1 == ip2:
		return True
	else:
		return False
        


src/s/f/sftf-HEAD/HFH/Via.py   sftf(Download)
from HeaderFieldHandler import HeaderFieldHandler
from SCException import SCNotImplemented, HFHException
from NetworkEventHandler import compareHostNames
 
class Via(HeaderFieldHandler):
		if self.transport != other.transport:
			ret += 1
		if not compareHostNames(self.host, other.host):
			ret += 1
		if self.port != other.port:

src/s/f/sftf-HEAD/HFH/sip_uri.py   sftf(Download)
from HeaderFieldHandler import HeaderFieldHandler
from SCException import SCNotImplemented
from NetworkEventHandler import compareHostNames
import urllib
 
		if self.password != other.password:
			ret = ret + 1
		if not compareHostNames(self.host, other.host):
			ret = ret + 1
		if self.ipv6 != other.ipv6:

src/s/f/sftf-HEAD/TestCase.py   sftf(Download)
from SipReply import SipReply
from SipMessage import SipMessage
from NetworkEventHandler import createMediaSockets, compareHostNames, NetworkEventHandler, getTransportNumber
from FileEventHandler import FileEventHandler
import time, socket
								via.transport = _NetworkEventHandler.getTransport()
								regen = True
							if not compareHostNames(via.host, _NetworkEventHandler.ip):
								via.host = _NetworkEventHandler.ip
								regen = True
								via.received = Message.request.event.srcAddress[0]
								regen = True
							elif not compareHostNames(via.host, Message.request.event.srcAddress[0]):
								via.received = Message.request.event.srcAddress[0]
								regen = True

src/s/f/sftf-HEAD/UserAgentBasicTestSuite/case301.py   sftf(Download)
			if reg.hasParsedHeaderField("From"):
				fm = reg.getParsedHeaderValue("From")
				if (not NEH.compareHostNames(fm.uri.host, Config.LOCAL_IP)) and (not NEH.compareHostNames(fm.uri.host, Config.LOCAL_HOSTNAME)):
					self.addResult(TestCase.TC_FAILED, "host part of From URI does not contain the SFTF host")
			else: