socket_impl.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2002-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Internal socket-specific definitions
*/
#ifndef _SOCKET_IMPL_H
#define _SOCKET_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Socket support definitions
*/
#define MAXSOCKET (10)
#define SOCKETTYPE (65536)
#define MEDIA_LVL 0
#define NETWORK_LVL 1
#define TRANSPORT_LVL 2
#define APP_LVL 3
/* Anonymous ports assigned by socket. */
#define SMALLEST_ANON_PORT 32768
/* Socket state bits. */
#define FD_TO_SOCKET(v) ((v) - SOCKETTYPE)
/*
* We need to do that to simplify the porting of TCP code from core
* kernel to inetboot. Note that fields which are not used by TCP
* code are removed.
*/
typedef struct msgb {
unsigned char *b_rptr;
unsigned char *b_wptr;
unsigned char *b_datap;
} mblk_t;
/* Modified stream routines to ease TCP porting. */
/*
* "target" is needed for input prior to IP address assignment. It may
* seem redundant given the binding information contained in the socket,
* but that's only true if we have an IP address. If we don't, and we
* try DHCP, we'll try to udp checksum using INADDR_ANY as the destination
* IP address, when in fact the destination IP address was the IP address
*/
struct inetgram {
/* Common */
int igm_level; /* Stack level (LVL) of data */
union {
struct {
/* Input specific */
} _IN_un;
struct {
/* Output specific */
int out_f;
} _OUT_un;
} _i_o_inet;
};
struct inetboot_socket {
int out_flags; /* 0 or MSG_DONTROUTE */
int so_error; /* Socket error */
int so_sndbuf; /* max send buf size */
int so_rcvbuf; /* max receive buf size */
void *pcb; /* Protocol control block */
};
extern void nuke_grams(struct inetgram **);
extern int so_check_fd(int, int *);
#ifdef __cplusplus
}
#endif
#endif /* _SOCKET_IMPL_H */