Lines Matching refs:sockets

50 struct inetboot_socket	sockets[MAXSOCKET] = { 0 };
76 if (sockets[i].type == INETBOOT_UNUSED) {
101 sockets[i].type = INETBOOT_UNUSED;
111 if (sockets[i].type == INETBOOT_UNUSED)
120 sockets[i].so_rcvbuf = SO_DEF_RCVBUF;
121 sockets[i].so_sndbuf = SO_DEF_SNDBUF;
130 ipv4_raw_socket(&sockets[i], (uint8_t)protocol);
133 udp_socket_init(&sockets[i]);
136 tcp_socket_init(&sockets[i]);
147 ipv4_socket_init(&sockets[i]);
150 mac_socket_init(&sockets[i]);
170 *((struct sockaddr_in *)name) = sockets[i].bind;
197 *(uint32_t *)optval = sockets[i].in_timeout;
206 (sockets[i].out_flags & SO_DONTROUTE);
215 (sockets[i].so_opt & SO_REUSEADDR);
223 *(int *)optval = sockets[i].so_rcvbuf;
231 *(int *)optval = sockets[i].so_sndbuf;
240 *(struct linger *)optval = sockets[i].so_linger;
318 sockets[i].in_timeout = *(uint32_t *)optval;
326 sockets[i].out_flags |= SO_DONTROUTE;
328 sockets[i].out_flags &= ~SO_DONTROUTE;
336 sockets[i].so_opt |= SO_REUSEADDR;
338 sockets[i].so_opt &= ~SO_REUSEADDR;
345 sockets[i].so_rcvbuf = *(int *)optval;
346 if (sockets[i].so_rcvbuf > SO_MAX_BUF)
347 sockets[i].so_rcvbuf = SO_MAX_BUF;
348 (void) tcp_opt_set(sockets[i].pcb,
356 sockets[i].so_sndbuf = *(int *)optval;
357 if (sockets[i].so_sndbuf > SO_MAX_BUF)
358 sockets[i].so_sndbuf = SO_MAX_BUF;
359 (void) tcp_opt_set(sockets[i].pcb,
368 sockets[i].so_linger = *(struct linger *)optval;
369 (void) tcp_opt_set(sockets[i].pcb,
404 * Only supported for TCP sockets
416 /* shutdown only supported for TCP sockets */
417 if (sockets[sock_id].type != INETBOOT_STREAM) {
422 if (!(sockets[sock_id].so_state & SS_ISCONNECTED)) {
429 sockets[sock_id].so_state |= SS_CANTRCVMORE;
432 sockets[sock_id].so_state |= SS_CANTSENDMORE;
435 sockets[sock_id].so_state |= (SS_CANTRCVMORE | SS_CANTSENDMORE);
442 switch (sockets[sock_id].so_state &
447 if (sockets[sock_id].close[i] != NULL) {
448 (void) sockets[sock_id].close[i](sock_id);
451 nuke_grams(&sockets[sock_id].inq);
454 nuke_grams(&sockets[sock_id].inq);
483 if (sockets[sock_id].close[i] != NULL) {
493 (void) sockets[sock_id].close[i](sock_id);
502 nuke_grams(&sockets[sock_id].inq);
504 bzero((caddr_t)&sockets[sock_id], sizeof (struct inetboot_socket));
505 sockets[sock_id].type = INETBOOT_UNUSED;
559 if (! (sockets[sock_id].so_opt & SO_REUSEADDR)) {
561 if (sockets[k].type != INETBOOT_UNUSED &&
562 sockets[k].proto == sockets[sock_id].proto &&
563 sockets[k].bound) {
564 if ((sockets[k].bind.sin_addr.s_addr ==
566 (sockets[k].bind.sin_port ==
590 if (sockets[i].bound) {
591 bzero((caddr_t)&sockets[i].bind,
593 sockets[i].bound = B_FALSE;
605 if (sockets[i].bound) {
606 if (bcmp((caddr_t)&sockets[i].bind, (caddr_t)name,
623 bcopy((caddr_t)name, (caddr_t)&sockets[i].bind, namelen);
624 if (sockets[i].type == INETBOOT_STREAM) {
629 sockets[i].bound = B_TRUE;
657 bcopy((caddr_t)&addr, (caddr_t)&sockets[sock_id].bind,
659 sockets[sock_id].bound = B_TRUE;
662 inet_ntoa(sockets[sock_id].bind.sin_addr),
663 ntohs(sockets[sock_id].bind.sin_port));
680 if (sockets[sock_id].type != INETBOOT_STREAM) {
684 if (sockets[sock_id].so_error != 0) {
685 errno = sockets[sock_id].so_error;
701 if (sockets[sock_id].type != INETBOOT_STREAM) {
705 if (sockets[sock_id].so_error != 0) {
706 errno = sockets[sock_id].so_error;
712 sockets[sock_id].so_state |= SS_ISCONNECTED;
726 so_type = sockets[sock_id].type;
738 if (sockets[sock_id].so_state & SS_ISCONNECTED) {
743 if (sockets[sock_id].so_error != 0) {
744 errno = sockets[sock_id].so_error;
749 if (!sockets[sock_id].bound) {
762 bcopy((caddr_t)addr, &sockets[sock_id].remote,
765 if (sockets[sock_id].type == INETBOOT_STREAM) {
768 sockets[sock_id].so_state |= SS_ISCONNECTED;
770 if (sockets[sock_id].so_error != 0)
771 errno = sockets[sock_id].so_error;
775 sockets[sock_id].so_state |= SS_ISCONNECTED;
811 if (sockets[sock_id].type == INETBOOT_STREAM &&
812 !(sockets[sock_id].so_state & SS_ISCONNECTED)) {
828 if (sockets[sock_id].inq == NULL) {
831 if (sockets[sock_id].input[i] != NULL) {
832 if (sockets[sock_id].input[i](sock_id) < 0) {
833 if (sockets[sock_id].so_error != 0) {
835 sockets[sock_id].so_error;
843 so_type = sockets[sock_id].type;
846 while ((icp = sockets[sock_id].inq) != NULL) {
854 del_gram(&sockets[sock_id].inq, icp, B_TRUE);
868 if (sockets[sock_id].so_state & SS_CANTRCVMORE) {
869 if (sockets[sock_id].so_error != 0) {
870 errno = sockets[sock_id].so_error;
889 bcopy(&(sockets[sock_id].remote), from, MIN(*fromlen,
911 del_gram(&sockets[sock_id].inq, icp, B_TRUE);
930 del_gram(&sockets[sock_id].inq, icp, B_TRUE);
936 while ((icp = sockets[sock_id].inq) != NULL) {
939 del_gram(&sockets[sock_id].inq, icp,
948 sockets[sock_id].so_rcvbuf += (int32_t)bytes;
957 del_gram(&sockets[sock_id].inq, icp, B_TRUE);
967 del_gram(&sockets[sock_id].inq, icp, B_TRUE);
1008 so_type = sockets[sock_id].type;
1013 if (sockets[sock_id].so_error != 0) {
1014 errno = sockets[sock_id].so_error;
1025 if (!(sockets[sock_id].so_state & SS_ISCONNECTED) &&
1033 if (!((sockets[sock_id].so_state & SS_ISCONNECTED) ||
1034 (sockets[sock_id].so_state & SS_ISCONNECTING))) {
1038 if (sockets[sock_id].so_state & SS_CANTSENDMORE) {
1069 nuke_grams(&sockets[i].inq); /* flush the input queue */
1072 offset = sockets[i].headerlen[MEDIA_LVL](NULL) +
1073 (sockets[i].headerlen[NETWORK_LVL])(NULL);
1076 if (sockets[i].type != INETBOOT_RAW) {
1077 offset += (sockets[i].headerlen[TRANSPORT_LVL])(NULL);
1086 bcopy((caddr_t)&sockets[i].remote, (caddr_t)&oc.igm_saddr,
1091 if (sockets[i].bound == B_FALSE &&
1098 if (sockets[i].type == INETBOOT_DGRAM) {
1113 if (sockets[i].output[l] != NULL) {
1114 if (sockets[i].output[l](i, &oc) < 0) {
1132 assert(sockets[i].pcb != NULL);
1141 if ((cnt = tcp_send(i, sockets[i].pcb, msg, len)) < 0) {
1142 if (sockets[i].so_error != 0)
1143 errno = sockets[i].so_error;