VirtualBox

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

Last change on this file since 70836 was 63199, checked in by vboxsync, 8 years ago

GuestHost/OpenGL: warnings (gcc).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
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 (void) hostname;
85}
86
87static int
88crDevnullDoConnect( CRConnection *conn )
89{
90 (void) conn;
91 return 1;
92}
93
94static void
95crDevnullDoDisconnect( CRConnection *conn )
96{
97 (void) conn;
98}
99
100void crDevnullConnection( CRConnection *conn )
101{
102 conn->type = CR_DROP_PACKETS;
103 conn->Alloc = crDevnullAlloc;
104 conn->Send = crDevnullSend;
105 conn->SendExact = crDevnullWriteExact;
106 conn->Recv = crDevnullSingleRecv;
107 conn->Free = crDevnullFree;
108 conn->Accept = crDevnullAccept;
109 conn->Connect = crDevnullDoConnect;
110 conn->Disconnect = crDevnullDoDisconnect;
111 conn->actual_network = 0;
112}
113
114CRConnection** crDevnullDump( int * num )
115{
116 *num = 0;
117 return NULL;
118}
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