# 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)
# 
# 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
from NetworkEventHandler import compareHostNames
import urllib
			uri = value
		# look for a username and password
		atsep = uri.find("@")
		if atsep > 0:
			unpw = uri[:atsep]
			hopo = uri[atsep+1:]
			pwsep = unpw.find(":")
			if pwsep > 0:
				self.username = unpw[:pwsep]
				self.password = unpw[pwsep+1:]
			else:
				self.username = unpw
		else:
			hopo = uri
		# serach for header fields
		hedsep = hopo.find("?")
		if hedsep > 0:
			self.headers = hopo[hedsep+1:].split("&")
			hopo = hopo[:hedsep]
		# search for uri parameters
		pasep = hopo.find(";")
		if pasep > 0:
			self.params = hopo[pasep+1:].split(";")
			hopo = hopo[:pasep]
		# check if it is an IPv6 address
		lb = hopo.find("[")
		if lb >= 0:
			rb = hopo.find("]")
			if rb > 0:
				self.host = hopo[lb+1:rb]

# 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)
# 
# 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/sip_uri.py
from HeaderFieldHandler import HeaderFieldHandler
from SCException import SCNotImplemented
from NetworkEventHandler import compareHostNames
import urllib

			uri = value
		# look for a username and password
		atsep = uri.find("@")
		if atsep > 0:
			unpw = uri[:atsep]
			hopo = uri[atsep+1:]
			pwsep = unpw.find(":")
			if pwsep > 0:
				self.username = unpw[:pwsep]
				self.password = unpw[pwsep+1:]
			else:
				self.username = unpw
		else:
			hopo = uri
		# serach for header fields
		hedsep = hopo.find("?")
		if hedsep > 0:
			self.headers = hopo[hedsep+1:].split("&")
			hopo = hopo[:hedsep]
		# search for uri parameters
		pasep = hopo.find(";")
		if pasep > 0:
			self.params = hopo[pasep+1:].split(";")
			hopo = hopo[:pasep]
		# check if it is an IPv6 address
		lb = hopo.find("[")
		if lb >= 0:
			rb = hopo.find("]")
			if rb > 0:
				self.host = hopo[lb+1:rb]

				self.ipv6 = True