Lines Matching +full:byte +full:- +full:len
27 /* socket routines by tridge - from junkcode.samba.org */
38 return -1; in ux_socket_connect()
46 if (fd == -1) { in ux_socket_connect()
47 return -1; in ux_socket_connect()
50 if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) { in ux_socket_connect()
52 return -1; in ux_socket_connect()
63 write_all(int fd, const void *buf, size_t len) in write_all() argument
66 while (len) { in write_all()
67 int n = write(fd, buf, len); in write_all()
70 len -= n; in write_all()
80 read_all(int fd, void *buf, size_t len) in read_all() argument
83 while (len) { in read_all()
84 int n = read(fd, buf, len); in read_all()
87 len -= n; in read_all()
97 send_packet(int fd, const char *buf, uint32_t len) in send_packet() argument
99 uint32_t net_len = htonl(len); in send_packet()
100 if (write_all(fd, &net_len, sizeof(net_len)) != sizeof(net_len)) return -1; in send_packet()
101 if (write_all(fd, buf, len) != len) return -1; in send_packet()
109 recv_packet(int fd, char **buf, uint32_t *len) in recv_packet() argument
111 if (read_all(fd, len, sizeof(*len)) != sizeof(*len)) return -1; in recv_packet()
112 *len = ntohl(*len); in recv_packet()
113 *buf = emalloc(*len); in recv_packet()
114 if (read_all(fd, *buf, *len) != *len) { in recv_packet()
117 return -1; in recv_packet()
133 * sent an all-zero signature, and we therefore know in send_via_ntp_signd()
137 * database just to find the long-term kerberos key in send_via_ntp_signd()
138 * that is re-used as the NTP key, we instead hand the in send_via_ntp_signd()
142 * Microsoft in MS-SNTP, found here: in send_via_ntp_signd()
143 * http://msdn.microsoft.com/en-us/library/cc212930.aspx in send_via_ntp_signd()
169 /* This will be echoed into the reply - a different in send_via_ntp_signd()
175 /* Swap the byte order back - it's actually little in send_via_ntp_signd()
177 * network byte order */ in send_via_ntp_signd()
185 if (fd != -1) { in send_via_ntp_signd()
189 [packet size as BE] - 4 bytes in send_via_ntp_signd()
190 [protocol version (0)] - 4 bytes in send_via_ntp_signd()
191 [packet ID] - 4 bytes in send_via_ntp_signd()
192 [operation (sign message=0)] - 4 bytes in send_via_ntp_signd()
193 [key id] - LITTLE endian (as on wire) - 4 bytes in send_via_ntp_signd()
194 [message to sign] - as marshalled, without signature in send_via_ntp_signd()
211 [packet size] - network byte order - 4 bytes in send_via_ntp_signd()
212 [protocol version (0)] network byte order - - 4 bytes in send_via_ntp_signd()
213 [operation (signed success=3, failure=4)] network byte order - - 4 byte in send_via_ntp_signd()
214 (optional) [signed message] - as provided before, with signature appended in send_via_ntp_signd()
220 sendlen = reply_len - offsetof(struct samba_key_out, pkt); in send_via_ntp_signd()
222 sendpkt(&rbufp->recv_srcadr, rbufp->dstadr, 0, xpkt, sendlen); in send_via_ntp_signd()
226 "transmit ntp_signd packet: at %ld %s->%s mode %d keyid %08x len %d\n", in send_via_ntp_signd()
227 current_time, ntoa(&rbufp->dstadr->sin), in send_via_ntp_signd()
228 ntoa(&rbufp->recv_srcadr), xmode, xkeyid, sendlen); in send_via_ntp_signd()