VirtualBox

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

最後變更 在這個檔案從66940是 63199,由 vboxsync 提交於 8 年 前

GuestHost/OpenGL: warnings (gcc).

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 2.2 KB
 
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}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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