# Path: SCException.py
# class SCNotImplemented (SCException):
# 	"""See SCException. Called if implementation is missing."""
# 
# 	def __init__(self, cls, function, reason):
# 		SCException.__init__(self, cls, function, reason)
# 
# class HFHException(SCException):
# 	"""See SCException. Called for exceptions during parsing header fields."""
# 
# 	def __init__(self, cls, function, reason):
# 		SCException.__init__(self, cls, function, reason)
# 
# Path: NetworkEventHandler.py
# 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


from HeaderFieldHandler import HeaderFieldHandler
from SCException import SCNotImplemented, HFHException
from NetworkEventHandler import compareHostNames
					self.branch = value
				elif (name == "rport"):
					if value == '':
						self.rport = "empty"
					else:
						self.rport = value
				else:
					if value == '':
						self.params.append(i.strip())
					else:
						self.params.append(name.strip() + "=" + value.strip())

	def sub_create(self):
		lead = ''
		hp = ''
		p = ''
		if self.protocol is not None:
			lead = str(self.protocol)
			if self.version is not None:
				lead = lead + '/' + str(self.version)
			if self.transport is not None:
				lead = lead + '/' + str(self.transport)
		if self.host is not None:
			if self.port is not None:
				hp = str(self.host) + ':' + str(self.port)
			else:
				hp = str(self.host)
		if self.branch is not None:
			p = p + ';branch=' + str(self.branch)
		if self.received is not None:

# Path: SCException.py
# class SCNotImplemented (SCException):
# 	"""See SCException. Called if implementation is missing."""
# 
# 	def __init__(self, cls, function, reason):
# 		SCException.__init__(self, cls, function, reason)
# 
# class HFHException(SCException):
# 	"""See SCException. Called for exceptions during parsing header fields."""
# 
# 	def __init__(self, cls, function, reason):
# 		SCException.__init__(self, cls, function, reason)
# 
# Path: NetworkEventHandler.py
# 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


# Path: HFH/Via.py
from HeaderFieldHandler import HeaderFieldHandler
from SCException import SCNotImplemented, HFHException
from NetworkEventHandler import compareHostNames

					self.branch = value
				elif (name == "rport"):
					if value == '':
						self.rport = "empty"
					else:
						self.rport = value
				else:
					if value == '':
						self.params.append(i.strip())
					else:
						self.params.append(name.strip() + "=" + value.strip())

	def sub_create(self):
		lead = ''
		hp = ''
		p = ''
		if self.protocol is not None:
			lead = str(self.protocol)
			if self.version is not None:
				lead = lead + '/' + str(self.version)
			if self.transport is not None:
				lead = lead + '/' + str(self.transport)
		if self.host is not None:
			if self.port is not None:
				hp = str(self.host) + ':' + str(self.port)
			else:
				hp = str(self.host)
		if self.branch is not None:
			p = p + ';branch=' + str(self.branch)
		if self.received is not None:

			p = p + ';received=' + str(self.received)