# DL_BIND_REQ and DL_UNBIND_REQ tests (for Ethernet)
# Tested:
# DL_BIND_REQ
#	OK
#	DL_OUTSTATE
#	DL_UNSUPPORTED
#	DL_BOUND (two LLC1 streams to same SAP)
# DL_UNBIND_REQ
#	OK
#	DL_OUTSTATE

open 1

# Attempt to bind when out of state (not attached)
bind $1 2000 1 0 0 0	dl_error_ack dl_outstate

attach $1 43

# Attempt to bind wth invalid service mode (4)
bind $1 2000 4 0 0 0	dl_error_ack dl_unsupported

# Attempt to bind with invalid service mode - connection-oriented
bind $1 2000 2 0 0 0	dl_error_ack dl_badaddr

check_state $1		dl_unbound

# Perform a valid bind
bind $1 2000 1 0 0 0

# Attempt a second bind
bind $1 2000 1 0 0 0	dl_error_ack dl_outstate

open 2
attach $2 43

# Attempt to bind a second stream to the same SAP
bind $2 2000 1 0 0 0	dl_error_ack dl_bound

# Attempt to bind a second stream successfully
bind $2 2001 1 0 0 0

open 3
attach $3 43

# Attempt to bind a third stream successfully
bind $3 2002 1 0 0 0

# Successful unbind (should be able to re-bind afterwards)
unbind $1

check_state $1		dl_unbound

# Attempt to rebind to a SAP in use
bind $1 2001 1 0 0 0	dl_error_ack dl_bound

# Attempt to bind to a valid SAP
bind $1 2003 1 0 0 0

unbind $3

# Attempt to unbind when out of state (not bound)
unbind $3		dl_error_ack dl_outstate

detach $3

# Another attempt to unbind when out of state (not attached)
unbind $3		dl_error_ack dl_outstate

unbind $1
unbind $2
