version 1.3, 1996/06/26 05:40:20 |
version 1.4, 1998/04/28 22:13:21 |
|
|
static char rcsid[] = "$OpenBSD$"; |
static char rcsid[] = "$OpenBSD$"; |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
#include <sys/types.h> |
#include "talk.h" |
#include <sys/socket.h> |
|
#include <sys/time.h> |
#include <sys/time.h> |
#include <netinet/in.h> |
|
#include <protocols/talkd.h> |
|
#include <errno.h> |
#include <errno.h> |
|
#include <unistd.h> |
#include "talk_ctl.h" |
#include "talk_ctl.h" |
|
|
#define CTL_WAIT 2 /* time to wait for a response, in seconds */ |
#define CTL_WAIT 2 /* time to wait for a response, in seconds */ |
|
|
/* |
/* |
* SOCKDGRAM is unreliable, so we must repeat messages if we have |
* SOCKDGRAM is unreliable, so we must repeat messages if we have |
* not recieved an acknowledgement within a reasonable amount |
* not received an acknowledgement within a reasonable amount |
* of time |
* of time |
*/ |
*/ |
|
void |
ctl_transact(target, msg, type, rp) |
ctl_transact(target, msg, type, rp) |
struct in_addr target; |
struct in_addr target; |
CTL_MSG msg; |
CTL_MSG msg; |
int type; |
int type; |
CTL_RESPONSE *rp; |
CTL_RESPONSE *rp; |
{ |
{ |
int read_mask, ctl_mask, nready, cc; |
fd_set read_mask, ctl_mask; |
|
int nready, cc; |
struct timeval wait; |
struct timeval wait; |
|
|
msg.type = type; |
msg.type = type; |
daemon_addr.sin_addr = target; |
daemon_addr.sin_addr = target; |
daemon_addr.sin_port = daemon_port; |
daemon_addr.sin_port = daemon_port; |
ctl_mask = 1 << ctl_sockt; |
FD_ZERO(&ctl_mask); |
|
FD_SET(ctl_sockt, &ctl_mask); |
|
|
/* |
/* |
* Keep sending the message until a response of |
* Keep sending the message until a response of |