101 |
#define BIND_LAST_ADDRESS 65534 |
#define BIND_LAST_ADDRESS 65534 |
102 |
static unsigned int iLastAddressUsed = BIND_INITIAL_ADDRESS; |
static unsigned int iLastAddressUsed = BIND_INITIAL_ADDRESS; |
103 |
|
|
104 |
DEFUN_NEW("OPEN-NAMED-SOCKET",object,fSopen_named_socket,SI,1,1,NONE,OI,OO,OO,OO,(int port), |
DEFUN_NEW("OPEN-NAMED-SOCKET",object,fSopen_named_socket,SI,1,1,NONE,OI,OO,OO,OO,(fixnum port), |
105 |
"Open a socket on PORT and return (cons fd portname) where file \ |
"Open a socket on PORT and return (cons fd portname) where file \ |
106 |
descriptor is a small fixnum which is the write file descriptor for \ |
descriptor is a small fixnum which is the write file descriptor for \ |
107 |
the socket. If PORT is zero do automatic allocation of port") |
the socket. If PORT is zero do automatic allocation of port") |
178 |
return make_cons(make_fixnum(s), small_fixnum(ntohs(addr.sin_port))); |
return make_cons(make_fixnum(s), small_fixnum(ntohs(addr.sin_port))); |
179 |
} |
} |
180 |
|
|
181 |
DEFUN_NEW("CLOSE-FD",object,fSclose_fd,SI,1,1,NONE,OI,OO,OO,OO,(int fd), |
DEFUN_NEW("CLOSE-FD",object,fSclose_fd,SI,1,1,NONE,OI,OO,OO,OO,(fixnum fd), |
182 |
"Close the file descriptor FD") |
"Close the file descriptor FD") |
183 |
|
|
184 |
{RETURN1(0==close(fd) ? Ct : Cnil);} |
{RETURN1(0==close(fd) ? Ct : Cnil);} |
308 |
{ return make_fixnum(OBJ_TO_CONNECTION_STATE(sfd)->fd); |
{ return make_fixnum(OBJ_TO_CONNECTION_STATE(sfd)->fd); |
309 |
} |
} |
310 |
|
|
311 |
DEFUN_NEW("OUR-WRITE",object,fSour_write,SI,3,3,NONE,OO,OI,OO,OO,(object sfd,object buffer,int nbytes),"") |
DEFUN_NEW("OUR-WRITE",object,fSour_write,SI,3,3,NONE,OO,OI,OO,OO,(object sfd,object buffer,fixnum nbytes),"") |
312 |
|
|
313 |
{ return make_fixnum(write1(OBJ_TO_CONNECTION_STATE(sfd),buffer->ust.ust_self,nbytes)); |
{ return make_fixnum(write1(OBJ_TO_CONNECTION_STATE(sfd),buffer->ust.ust_self,nbytes)); |
314 |
} |
} |
315 |
|
|
316 |
DEFUN_NEW("OUR-READ-WITH-OFFSET",object,fSour_read_with_offset,SI,5,5,NONE, |
DEFUN_NEW("OUR-READ-WITH-OFFSET",object,fSour_read_with_offset,SI,5,5,NONE, |
317 |
OO,OI,II,OO,(object fd,object buffer,int offset,int nbytes,int timeout), |
OO,OI,II,OO,(object fd,object buffer,fixnum offset,fixnum nbytes,fixnum timeout), |
318 |
"Read from STATE-FD into string BUFFER putting data at OFFSET and reading NBYTES, waiting for TIMEOUT before failing") |
"Read from STATE-FD into string BUFFER putting data at OFFSET and reading NBYTES, waiting for TIMEOUT before failing") |
319 |
|
|
320 |
{ return make_fixnum(read1(OBJ_TO_CONNECTION_STATE(fd),&((buffer)->ust.ust_self[offset]),nbytes,timeout)); |
{ return make_fixnum(read1(OBJ_TO_CONNECTION_STATE(fd),&((buffer)->ust.ust_self[offset]),nbytes,timeout)); |
473 |
{ FEerror("Function not defined for this operating system",0);} |
{ FEerror("Function not defined for this operating system",0);} |
474 |
|
|
475 |
|
|
476 |
DEFUN_NEW("SET-SIGIO-FOR-FD",object,fSset_sigio_for_fd,SI,1,1,NONE,OI,OO,OO,OO,(int fd),"") |
DEFUN_NEW("SET-SIGIO-FOR-FD",object,fSset_sigio_for_fd,SI,1,1,NONE,OI,OO,OO,OO,(fixnum fd),"") |
477 |
|
|
478 |
{ |
{ |
479 |
/* for the moment we will use SIGUSR1 to notify, instead of depending on SIGIO, |
/* for the moment we will use SIGUSR1 to notify, instead of depending on SIGIO, |
502 |
|
|
503 |
} |
} |
504 |
|
|
505 |
DEFUN_NEW("RESET-STRING-INPUT-STREAM",object,fSreset_string_input_stream,SI,4,4,NONE,OO,OI,IO,OO,(object strm,object string,int start,int end), |
DEFUN_NEW("RESET-STRING-INPUT-STREAM",object,fSreset_string_input_stream,SI,4,4,NONE,OO,OI,IO,OO,(object strm,object string,fixnum start,fixnum end), |
506 |
"Reuse a string output STREAM by setting its output to STRING \ |
"Reuse a string output STREAM by setting its output to STRING \ |
507 |
and positioning the ouput/input to start at START and end at END") |
and positioning the ouput/input to start at START and end at END") |
508 |
|
|
512 |
return strm; |
return strm; |
513 |
} |
} |
514 |
|
|
515 |
DEFUN_NEW("CHECK-STATE-INPUT",object,fScheck_state_input,SI,2,2,NONE,OO,IO,OO,OO,(object osfd,int timeout), |
DEFUN_NEW("CHECK-STATE-INPUT",object,fScheck_state_input,SI,2,2,NONE,OO,IO,OO,OO,(object osfd,fixnum timeout), |
516 |
"") |
"") |
517 |
{ |
{ |
518 |
return fScheck_dsfd_for_input(OBJ_TO_CONNECTION_STATE(osfd),timeout); |
return fScheck_dsfd_for_input(OBJ_TO_CONNECTION_STATE(osfd),timeout); |