mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-06-28 13:29:37 +00:00
Made tcp_listen return the client IP address.
Together with the recent change to provide the inbound data buffer address and length to the TCP callback function as C parameters this change allows the TCP API to get along without any global variable :-)
This commit is contained in:
parent
e1bf89d1a8
commit
e6684904cf
|
@ -181,9 +181,9 @@ unsigned char __fastcall__ udp_send(const unsigned char* buf, unsigned int len,
|
|||
// callback: Vector to call when data arrives on this connection
|
||||
// buf: Pointer to buffer with data received
|
||||
// len: -1 on close, otherwise length of data received
|
||||
// Output: 1 if an error occured, 0 otherwise
|
||||
// Output: IP address of the connected client, 0 on error
|
||||
//
|
||||
unsigned char __fastcall__ tcp_listen(unsigned int port,
|
||||
unsigned long __fastcall__ tcp_listen(unsigned int port,
|
||||
void (*callback)(const unsigned char* buf, int len));
|
||||
|
||||
// Make outbound TCP connection
|
||||
|
|
10
ip65/tcp_c.s
10
ip65/tcp_c.s
|
@ -15,6 +15,7 @@
|
|||
.import tcp_send_keep_alive
|
||||
|
||||
.import tcp_callback
|
||||
.import tcp_remote_ip
|
||||
.import tcp_connect_ip
|
||||
.import tcp_send_data_len
|
||||
|
||||
|
@ -40,9 +41,16 @@ _tcp_listen:
|
|||
stax tcp_callback
|
||||
jsr popax
|
||||
jsr tcp_listen
|
||||
bcs error
|
||||
ldax tcp_remote_ip+2
|
||||
stax sreg
|
||||
ldax tcp_remote_ip
|
||||
rts
|
||||
|
||||
error:
|
||||
ldx #$00
|
||||
txa
|
||||
rol
|
||||
stax sreg
|
||||
rts
|
||||
|
||||
_tcp_connect:
|
||||
|
|
Loading…
Reference in New Issue
Block a user