VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/util/devnull.c@ 43222

Last change on this file since 43222 was 33540, checked in by vboxsync, 14 years ago

*: spelling fixes, thanks Timeless!

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#include "cr_net.h"
8#include "cr_mem.h"
9#include "cr_error.h"
10#include "net_internals.h"
11
12static void
13crDevnullWriteExact( CRConnection *conn, const void *buf, unsigned int len )
14{
15 (void) conn;
16 (void) buf;
17 (void) len;
18}
19
20static void *
21crDevnullAlloc( CRConnection *conn )
22{
23 return crAlloc( conn->buffer_size );
24}
25
26static void
27crDevnullSingleRecv( CRConnection *conn, void *buf, unsigned int len )
28{
29 crError( "You can't receive data on a devnull connection!" );
30 (void) conn;
31 (void) buf;
32 (void) len;
33}
34
35static void
36crDevnullFree( CRConnection *conn, void *buf )
37{
38 crFree( buf );
39 (void) conn;
40}
41
42static void
43crDevnullSend( CRConnection *conn, void **bufp,
44 const void *start, unsigned int len )
45{
46
47 if (bufp)
48 {
49 /* We're sending something we've allocated. It's now ours.
50 * If the callers wants to send something else, he'll allocate
51 * something else.
52 *
53 * ENFORCE IT! */
54
55 crDevnullFree( conn, *bufp );
56 }
57 (void) conn;
58 (void) bufp;
59 (void) start;
60 (void) len;
61}
62
63int
64crDevnullRecv( void )
65{
66 crError( "You can't receive data on a DevNull network, stupid." );
67 return 0;
68}
69
70void
71crDevnullInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu )
72{
73 (void) rfl;
74 (void) cfl;
75 (void) mtu;
76}
77
78static void
79crDevnullAccept( CRConnection *conn, const char *hostname, unsigned short port )
80{
81 crError( "Well, you *could* accept a devnull client, but you'd be disappointed. ");
82 (void) conn;
83 (void) port;
84}
85
86static int
87crDevnullDoConnect( CRConnection *conn )
88{
89 (void) conn;
90 return 1;
91}
92
93static void
94crDevnullDoDisconnect( CRConnection *conn )
95{
96 (void) conn;
97}
98
99void crDevnullConnection( CRConnection *conn )
100{
101 conn->type = CR_DROP_PACKETS;
102 conn->Alloc = crDevnullAlloc;
103 conn->Send = crDevnullSend;
104 conn->SendExact = crDevnullWriteExact;
105 conn->Recv = crDevnullSingleRecv;
106 conn->Free = crDevnullFree;
107 conn->Accept = crDevnullAccept;
108 conn->Connect = crDevnullDoConnect;
109 conn->Disconnect = crDevnullDoDisconnect;
110 conn->actual_network = 0;
111}
112
113CRConnection** crDevnullDump( int * num )
114{
115 *num = 0;
116 return NULL;
117}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette