/* Send a self-contained ISO PDU */
static void
-iso_send_msg(uint8 code)
+iso_send_msg(uint8 code, uint8 class)
{
STREAM s;
out_uint8(s, 6); /* hdrlen */
out_uint8(s, code);
- out_uint16(s, 0); /* dst_ref */
- out_uint16(s, 0); /* src_ref */
- out_uint8(s, 0); /* class */
+ out_uint16(s, 0); /* dst_ref */
+ out_uint16_be(s, 0x1234); /* src_ref */
+ out_uint8(s, class); /* class */
s_mark_end(s);
tcp_send(s);
return s;
}
-/* Establish a connection up to the ISO layer */
BOOL
-iso_connect(char *server, char *username)
+iso_recv_connect(int server_sock)
{
+ STREAM s, t;
uint8 code;
- if (!tcp_connect(server))
- return False;
-
- iso_send_connection_request(username);
-
- if (iso_recv_msg(&code) == NULL)
- return False;
+ tcp_recv_connect(server_sock);
+
+ s = iso_recv_msg(&code);
+ if (s == NULL)
+ return 0;
- if (code != ISO_PDU_CC)
+ if (code != ISO_PDU_CR)
{
- error("expected CC, got 0x%x\n", code);
- tcp_disconnect();
- return False;
+ error("expected CR, got 0x%x\n", code);
+ return 0;
}
- return True;
+ DEBUG(("Got ISO connection request\n"));
+
+ iso_send_msg(ISO_PDU_CC, 0);
+ return 1;
}
/* Disconnect from the ISO layer */
void
iso_disconnect(void)
{
- iso_send_msg(ISO_PDU_DR);
+ iso_send_msg(ISO_PDU_DR, 0);
tcp_disconnect();
}