Mercurial > ecos
comparison packages/io/fileio/current/include/sockio.h @ 115:6ed91473a1cd ecos-sw-2000-08-21
Merge from eCos master repository on 2000-08-21-22:40:54-BST
| author | jlarmour |
|---|---|
| date | Fri, 25 Aug 2000 17:32:38 +0000 |
| parents | |
| children | 6bd9d475ed4b |
comparison
equal
deleted
inserted
replaced
| 114:5ad2b71d525e | 115:6ed91473a1cd |
|---|---|
| 1 #ifndef CYGONCE_SOCKIO_H | |
| 2 #define CYGONCE_SOCKIO_H | |
| 3 //============================================================================= | |
| 4 // | |
| 5 // sockio.h | |
| 6 // | |
| 7 // Socket IO header | |
| 8 // | |
| 9 //============================================================================= | |
| 10 //####COPYRIGHTBEGIN#### | |
| 11 // | |
| 12 // ------------------------------------------- | |
| 13 // The contents of this file are subject to the Red Hat eCos Public License | |
| 14 // Version 1.1 (the "License"); you may not use this file except in | |
| 15 // compliance with the License. You may obtain a copy of the License at | |
| 16 // http://www.redhat.com/ | |
| 17 // | |
| 18 // Software distributed under the License is distributed on an "AS IS" | |
| 19 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 20 // License for the specific language governing rights and limitations under | |
| 21 // the License. | |
| 22 // | |
| 23 // The Original Code is eCos - Embedded Configurable Operating System, | |
| 24 // released September 30, 1998. | |
| 25 // | |
| 26 // The Initial Developer of the Original Code is Red Hat. | |
| 27 // Portions created by Red Hat are | |
| 28 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. | |
| 29 // All Rights Reserved. | |
| 30 // ------------------------------------------- | |
| 31 // | |
| 32 //####COPYRIGHTEND#### | |
| 33 //============================================================================= | |
| 34 //#####DESCRIPTIONBEGIN#### | |
| 35 // | |
| 36 // Author(s): nickg | |
| 37 // Contributors: nickg | |
| 38 // Date: 2000-05-25 | |
| 39 // Purpose: Socket IO header | |
| 40 // Description: This header contains the external definitions of the general | |
| 41 // socket IO subsystem for POSIX and EL/IX compatability. | |
| 42 // | |
| 43 // Usage: | |
| 44 // #include <sockio.h> | |
| 45 // ... | |
| 46 // | |
| 47 // | |
| 48 //####DESCRIPTIONEND#### | |
| 49 // | |
| 50 //============================================================================= | |
| 51 | |
| 52 #include <pkgconf/hal.h> | |
| 53 #include <pkgconf/kernel.h> | |
| 54 #include <pkgconf/io_fileio.h> | |
| 55 | |
| 56 #include <cyg/infra/cyg_type.h> | |
| 57 | |
| 58 #include <stddef.h> // NULL, size_t | |
| 59 #include <limits.h> | |
| 60 #include <sys/types.h> | |
| 61 | |
| 62 #include <cyg/fileio/fileio.h> | |
| 63 | |
| 64 //============================================================================= | |
| 65 // Forward definitions | |
| 66 | |
| 67 struct cyg_nstab_entry; | |
| 68 typedef struct cyg_nstab_entry cyg_nstab_entry; | |
| 69 | |
| 70 struct cyg_sock_ops; | |
| 71 typedef struct cyg_sock_ops cyg_sock_ops; | |
| 72 | |
| 73 struct sockaddr; | |
| 74 typedef struct sockaddr sockaddr; | |
| 75 | |
| 76 struct msghdr; | |
| 77 typedef struct msghdr msghdr; | |
| 78 | |
| 79 #ifndef CYGPKG_NET | |
| 80 | |
| 81 typedef cyg_uint32 socklen_t; /* length type for network syscalls */ | |
| 82 | |
| 83 #endif | |
| 84 | |
| 85 //============================================================================= | |
| 86 // network stack entry | |
| 87 | |
| 88 struct cyg_nstab_entry | |
| 89 { | |
| 90 cyg_bool valid; // true if stack initialized | |
| 91 cyg_uint32 syncmode; // synchronization protocol | |
| 92 char *name; // stack name | |
| 93 char *devname; // hardware device name | |
| 94 CYG_ADDRWORD data; // private data value | |
| 95 | |
| 96 int (*init)( cyg_nstab_entry *nste ); | |
| 97 int (*socket)( cyg_nstab_entry *nste, int domain, int type, | |
| 98 int protocol, cyg_file *file ); | |
| 99 }; | |
| 100 | |
| 101 #define NSTAB_ENTRY( _l, _syncmode, _name, _devname, _data, _init, _socket ) \ | |
| 102 struct cyg_nstab_entry _l CYG_HAL_TABLE_ENTRY(nstab) = \ | |
| 103 { \ | |
| 104 false, \ | |
| 105 _syncmode, \ | |
| 106 _name, \ | |
| 107 _devname, \ | |
| 108 _data, \ | |
| 109 _init, \ | |
| 110 _socket \ | |
| 111 }; | |
| 112 | |
| 113 //============================================================================= | |
| 114 | |
| 115 struct cyg_sock_ops | |
| 116 { | |
| 117 int (*bind) ( cyg_file *fp, const sockaddr *sa, socklen_t len ); | |
| 118 int (*connect) ( cyg_file *fp, const sockaddr *sa, socklen_t len ); | |
| 119 int (*accept) ( cyg_file *fp, cyg_file *new_fp, | |
| 120 struct sockaddr *name, socklen_t *anamelen ); | |
| 121 int (*listen) ( cyg_file *fp, int len ); | |
| 122 int (*getname) ( cyg_file *fp, sockaddr *sa, socklen_t *len, int peer ); | |
| 123 int (*shutdown) ( cyg_file *fp, int flags ); | |
| 124 int (*getsockopt)( cyg_file *fp, int level, int optname, | |
| 125 void *optval, socklen_t *optlen); | |
| 126 int (*setsockopt)( cyg_file *fp, int level, int optname, | |
| 127 const void *optval, socklen_t optlen); | |
| 128 int (*sendmsg) ( cyg_file *fp, const struct msghdr *m, | |
| 129 int flags, ssize_t *retsize ); | |
| 130 int (*recvmsg) ( cyg_file *fp, struct msghdr *m, | |
| 131 socklen_t *namelen, ssize_t *retsize ); | |
| 132 }; | |
| 133 | |
| 134 //----------------------------------------------------------------------------- | |
| 135 #endif // ifndef CYGONCE_SOCKIO_H | |
| 136 // End of sockio.h |
