2 * (C) Copyright 2009 ZeXx86 (zexx86@gmail.com)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 void guest_read_host_requests (pluginData
*pd
)
32 if (fread (&cmd
, sizeof (int), 1, pd
->pr
) <= 0)
37 fread (&s
, sizeof (s
), 1, pd
->pr
);
39 pd
->handle_newstream (pd
,s
);
41 case gln_destroy_stream
:
42 fread (&s
, sizeof (s
), 1, pd
->pr
);
44 pd
->handle_destroystream (pd
, s
);
51 fread (&s
, sizeof (s
), 1, pd
->pr
);
52 fread (&off
, sizeof (off
), 1, pd
->pr
);
53 fread (&len
, sizeof (len
), 1, pd
->pr
);
58 fread (data
,len
,1,pd
->pr
);
60 pd
->handle_write (pd
, s
, off
, len
, data
);
68 Log ("Unhandled request to guest: %d", cmd
);
72 void guest_newstream (pluginData
*pd
, NPStream
*s
)
74 Log ("guest has NEWSTREAM: %p",s
);
77 void guest_destroystream (pluginData
*pd
, NPStream
*s
)
79 Log ("guest has DESTROYSTREAM: %p",s
);
82 void guest_write (pluginData
*pd
, NPStream
*s
, int32 off
, int32 len
, void *data
)
84 Log ("guest has WRITE: %p %d %d, data followz:", s
, off
, len
);
87 for (i
= 0; i
< len
; ++ i
)
88 Log ("%8X: %c",i
, ((char *) data
)[i
]);
91 void glugin_proc (pluginData
*pd
)
93 while (!(pd
->exit_request
)) {
94 guest_read_host_requests (pd
);