summaryrefslogtreecommitdiffstats
path: root/kdejava/koala/org/kde/koala/SlaveBase.java
blob: 238b16412388f0a843076e9749da2a1410b9cc7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
//Auto-generated by kalyptus. DO NOT EDIT.
package org.kde.koala;

import org.kde.qt.Qt;
import org.kde.qt.QtSupport;

/**

 There are two classes that specifies the protocol between application (job)
 and tdeioslave. SlaveInterface is the class to use on the application end,
 SlaveBase is the one to use on the slave end.
 Slave implementations should simply inherit SlaveBase
 A call to foo() results in a call to slotFoo() on the other end.
 		@short    There are two classes that specifies the protocol between application (job)  and tdeioslave.

*/
public class SlaveBase implements QtSupport {
	private long _qt;
	private boolean _allocatedInJavaWorld = true;
	protected SlaveBase(Class dummy){}

	/**	
			 Terminate the slave by calling the destructor and then .exit()
		     		@short
	*/
	public native void exit();
	/**	
			     		@short
	*/
	public native void dispatchLoop();
	/**	
			     		@short
	*/
	public native void setConnection(Connection connection);
	/**	
			     		@short
	*/
	public native Connection connection();
	/**	
		 Sends data in the slave to the job (i.e. in get).
			 To signal end of data, simply send an empty
		 byte[]().
			@param data the data read by the slave
		     		@short    Sends data in the slave to the job (i.
	*/
	public native void data(byte[] data);
	/**	
		 Asks for data from the job.
				@short    Asks for data from the job.
		@see #readData
	*/
	public native void dataReq();
	/**	
		 Call to signal an error.
		 This also finishes the job, no need to call finished.
			 If the Error code is KIO.ERR_SLAVE_DEFINED then the
		 _text should contain the complete translated text of
		 of the error message.  This message will be displayed
		 in an KTextBrowser which allows rich text complete
		 with hyper links.  Email links will call the default
		 mailer, "exec:/command arg1 arg2" will be forked and
		 all other links will call the default browser.
			@param _errid the error code from KIO.Error
			@param _text the rich text error message
		     		@short    Call to signal an error.
		@see Error
		@see KTextBrowser
	*/
	public native void error(int _errid, String _text);
	/**	
		 Call in openConnection, if you reimplement it, when you're done.
		     		@short    Call in openConnection, if you reimplement it, when you're done.
	*/
	public native void connected();
	/**	
		 Call to signal successful completion of any command
		 (besides openConnection and closeConnection)
		     		@short    Call to signal successful completion of any command  (besides openConnection and closeConnection)
	*/
	public native void finished();
	/**	
		 Call to signal that data from the sub-URL is needed
		     		@short    Call to signal that data from the sub-URL is needed
	*/
	public native void needSubURLData();
	/**	
		 Used to report the status of the slave.
			@param host the slave is currently connected to. (Should be
		        empty if not connected)
			@param connected Whether an actual network connection exists.
				@short    Used to report the status of the slave.
	*/
	public native void slaveStatus(String host, boolean connected);
	/**	
		 Call this from stat() to express details about an object, the
		 UDSEntry customarily contains the atoms describing file name, size,
		 mimetype, etc.
			@param _entry The UDSEntry containing all of the object attributes.
		     		@short    Call this from stat() to express details about an object, the  UDSEntry customarily contains the atoms describing file name, size,  mimetype, etc.
	*/
	// void statEntry(const TDEIO::UDSEntry& arg1); >>>> NOT CONVERTED
	/**	
		 Call this in listDir, each time you have a bunch of entries
		 to report.
			@param _entry The UDSEntry containing all of the object attributes.
		     		@short    Call this in listDir, each time you have a bunch of entries  to report.
	*/
	// void listEntries(const TDEIO::UDSEntryList& arg1); >>>> NOT CONVERTED
	/**	
		 Call this at the beginning of put(), to give the size of the existing
		 partial file, if there is one. The <code>offset</code> argument notifies the
		 other job (the one that gets the data) about the offset to use.
		 In this case, the booleanean returns whether we can indeed resume or not
		 (we can't if the protocol doing the get() doesn't support setting an offset)
		     		@short    Call this at the beginning of put(), to give the size of the existing  partial file, if there is one.
	*/
	public native boolean canResume(long offset);
	public native void canResume();
	/**	
		 Call this in get and copy, to give the total size
		 of the file
		 Call in listDir too, when you know the total number of items.
		     		@short    Call this in get and copy, to give the total size  of the file  Call in listDir too, when you know the total number of items.
	*/
	public native void totalSize(long _bytes);
	/**	
		 Call this during get and copy, once in a while,
		 to give some info about the current state.
		 Don't emit it in listDir, listEntries speaks for itself.
		     		@short    Call this during get and copy, once in a while,  to give some info about the current state.
	*/
	public native void processedSize(long _bytes);
	/**	
		 Only use this if you can't know in advance the size of the
		 copied data. For example, if you're doing variable bitrate
		 compression of the source.
			 STUB ! Currently unimplemented. Here now for binary compatibility.
			 Call this during get and copy, once in a while,
		 to give some info about the current state.
		 Don't emit it in listDir, listEntries speaks for itself.
		     		@short    Only use this if you can't know in advance the size of the  copied data.
	*/
	public native void processedPercent(float percent);
	/**	
		 Call this in get and copy, to give the current transfer
		 speed, but only if it can't be calculated out of the size you
		 passed to processedSize (in most cases you don't want to call it)
		     		@short    Call this in get and copy, to give the current transfer  speed, but only if it can't be calculated out of the size you  passed to processedSize (in most cases you don't want to call it)
	*/
	public native void speed(long _bytes_per_second);
	/**	
		 Call this to signal a redirection
		 The job will take care of going to that url.
		     		@short    Call this to signal a redirection  The job will take care of going to that url.
	*/
	public native void redirection(KURL _url);
	/**	
		 Tell that we will only get an error page here.
		 This means: the data you'll get isn't the data you requested,
		 but an error page (usually HTML) that describes an error.
		     		@short    Tell that we will only get an error page here.
	*/
	public native void errorPage();
	/**	
		 Call this in mimetype() and in get(), when you know the mimetype.
		 See mimetype about other ways to implement it.
		     		@short    Call this in mimetype() and in get(), when you know the mimetype.
	*/
	public native void mimeType(String _type);
	/**	
		 Call to signal a warning, to be displayed in a dialog box.
		     		@short    Call to signal a warning, to be displayed in a dialog box.
	*/
	public native void warning(String msg);
	/**	
		 Call to signal a message, to be displayed if the application wants to,
		 for instance in a status bar. Usual examples are "connecting to host xyz", etc.
		     		@short    Call to signal a message, to be displayed if the application wants to,  for instance in a status bar.
	*/
	public native void infoMessage(String msg);
	/**	
		 Call this to show a message box from the slave
			@param type type of message box: QuestionYesNo, WarningYesNo, WarningContinueCancel...
			@param text Message string. May contain newlines.
			@param caption Message box title.
			@param buttonYes The text for the first button.
		                  The default is i18n("&Yes").
			@param buttonNo The text for the second button.
		                  The default is i18n("&No").
		 Note: for ContinueCancel, buttonYes is the continue button and buttonNo is unused.
		       and for Information, none is used.
				@return a button code, as defined in KMessageBox, or 0 on communication error.
     
		@short    Call this to show a message box from the slave
	*/
	// int messageBox(TDEIO::SlaveBase::MessageBoxType arg1,const TQString& arg2,const TQString& arg3,const TQString& arg4,const TQString& arg5); >>>> NOT CONVERTED
	// int messageBox(TDEIO::SlaveBase::MessageBoxType arg1,const TQString& arg2,const TQString& arg3,const TQString& arg4); >>>> NOT CONVERTED
	// int messageBox(TDEIO::SlaveBase::MessageBoxType arg1,const TQString& arg2,const TQString& arg3); >>>> NOT CONVERTED
	// int messageBox(TDEIO::SlaveBase::MessageBoxType arg1,const TQString& arg2); >>>> NOT CONVERTED
	/**	
		 Call this to show a message box from the slave
			@param text Message string. May contain newlines.
			@param type type of message box: QuestionYesNo, WarningYesNo, WarningContinueCancel...
			@param caption Message box title.
			@param buttonYes The text for the first button.
		                  The default is i18n("&Yes").
			@param buttonNo The text for the second button.
		                  The default is i18n("&No").
		 Note: for ContinueCancel, buttonYes is the continue button and buttonNo is unused.
		       and for Information, none is used.
			@param dontAskAgainName A checkbox is added with which further confirmation can be turned off.
		        The string is used to lookup and store the setting in tdeioslaverc.
				@return a button code, as defined in KMessageBox, or 0 on communication error.

		@short    Call this to show a message box from the slave
	*/
	// int messageBox(const TQString& arg1,TDEIO::SlaveBase::MessageBoxType arg2,const TQString& arg3,const TQString& arg4,const TQString& arg5,const TQString& arg6); >>>> NOT CONVERTED
	// int messageBox(const TQString& arg1,TDEIO::SlaveBase::MessageBoxType arg2,const TQString& arg3,const TQString& arg4,const TQString& arg5); >>>> NOT CONVERTED
	// int messageBox(const TQString& arg1,TDEIO::SlaveBase::MessageBoxType arg2,const TQString& arg3,const TQString& arg4); >>>> NOT CONVERTED
	// int messageBox(const TQString& arg1,TDEIO::SlaveBase::MessageBoxType arg2,const TQString& arg3); >>>> NOT CONVERTED
	// int messageBox(const TQString& arg1,TDEIO::SlaveBase::MessageBoxType arg2); >>>> NOT CONVERTED
	/**	
		 Sets meta-data to be send to the application before the first
		 data() or finished() signal.
		     		@short    Sets meta-data to be send to the application before the first  data() or finished() signal.
	*/
	public native void setMetaData(String key, String value);
	/**	
		 Queries for the existence of a certain config/meta-data entry
		 send by the application to the slave.
				@short    Queries for the existence of a certain config/meta-data entry  send by the application to the slave.
	*/
	public native boolean hasMetaData(String key);
	/**	
		 Queries for config/meta-data send by the application to the slave.
				@short    Queries for config/meta-data send by the application to the slave.
	*/
	public native String metaData(String key);
	/**	
		 Returns a configuration object to query config/meta-data information
		 from.
			 The application provides the slave with all configuration information
		 relevant for the current protocol and host.
		     		@short    Returns a configuration object to query config/meta-data information  from.
	*/
	public native TDEConfigBase config();
	/**	
		 Returns an object that can translate remote filenames into proper
		 Unicode forms. This encoding can be set by the user.
				@short    Returns an object that can translate remote filenames into proper  Unicode forms.
	*/
	// KRemoteEncoding* remoteEncoding(); >>>> NOT CONVERTED
	/**	
		 Set the host
			@param pass  Called directly by createSlave, this is why there is no equivalent in
		 SlaveInterface, unlike the other methods.
			 This method is called whenever a change in host, port or user occurs.
		     		@short    Set the host
	*/
	public native void setHost(String host, int port, String user, String pass);
	/**	
		 Prepare slave for streaming operation
		     		@short    Prepare slave for streaming operation
	*/
	public native void setSubURL(KURL url);
	/**	
		 Opens the connection (forced)
		 When this function gets called the slave is operating in
		 connection-oriented mode.
		 When a connection gets lost while the slave operates in
		 connection oriented mode, the slave should report
		 ERR_CONNECTION_BROKEN instead of reconnecting. The user is
		 expected to disconnect the slave in the error handler.
		     		@short    Opens the connection (forced)  When this function gets called the slave is operating in  connection-oriented mode.
	*/
	public native void openConnection();
	/**	
		 Closes the connection (forced)
		 Called when the application disconnects the slave to close
		 any open network connections.
			 When the slave was operating in connection-oriented mode,
		 it should reset itself to connectionless (default) mode.
		     		@short    Closes the connection (forced)  Called when the application disconnects the slave to close  any open network connections.
	*/
	public native void closeConnection();
	/**	
		 get, aka read.
			@param url the full url for this request. Host, port and user of the URL
		        can be assumed to be the same as in the last setHost() call.
		 The slave emits the data through data
		     		@short    get, aka read.
	*/
	public native void get(KURL url);
	/**	
		 put, aka write.
			@param url where to write the file (decoded)
			@param permissions may be -1. In this case no special permission mode is set.
			@param overwrite if true, any existing file will be overwritten.
		 If the file indeed already exists, the slave should NOT apply the
		 permissions change to it.
			@param resume      		@short    put, aka write.
	*/
	public native void put(KURL url, int permissions, boolean overwrite, boolean resume);
	/**	
		 Finds all details for one file or directory.
		 The information returned is the same as what listDir returns,
		 but only for one file or directory.
		     		@short    Finds all details for one file or directory.
	*/
	public native void stat(KURL url);
	/**	
		 Finds mimetype for one file or directory.
			 This method should either emit 'mimeType' or it
		 should send a block of data big enough to be able
		 to determine the mimetype.
			 If the slave doesn't reimplement it, a get will
		 be issued, i.e. the whole file will be downloaded before
		 determining the mimetype on it - this is obviously not a
		 good thing in most cases.
		     		@short    Finds mimetype for one file or directory.
	*/
	public native void mimetype(KURL url);
	/**	
		 Lists the contents of <code>url.</code>
		 The slave should emit ERR_CANNOT_ENTER_DIRECTORY if it doesn't exist,
		 if we don't have enough permissions, or if it is a file
		 It should also emit totalFiles as soon as it knows how many
		 files it will list.
		     		@short    Lists the contents of <code>url.</code>
	*/
	public native void listDir(KURL url);
	/**	
		 Create a directory
			@param url path to the directory to create
			@param permissions the permissions to set after creating the directory
		 (-1 if no permissions to be set)
		 The slave emits ERR_COULD_NOT_MKDIR if failure.
		     		@short    Create a directory
	*/
	public native void mkdir(KURL url, int permissions);
	/**	
		 Rename <code>oldname</code> into <code>newname.</code>
		 If the slave returns an error ERR_UNSUPPORTED_ACTION, the job will
		 ask for copy + del instead.
			@param src where to move the file from
			@param dest where to move the file to
			@param overwrite if true, any existing file will be overwritten
		     		@short    Rename <code>oldname</code> into <code>newname.</code>
	*/
	public native void rename(KURL src, KURL dest, boolean overwrite);
	/**	
		 Creates a symbolic link named <code>dest</code>, pointing to <code>target</code>, which
		 may be a relative or an absolute path.
			@param target The string that will become the "target" of the link (can be relative)
			@param dest The symlink to create.
			@param overwrite whether to automatically overwrite if the dest exists
		     		@short    Creates a symbolic link named <code>dest</code>, pointing to <code>target</code>, which  may be a relative or an absolute path.
	*/
	public native void symlink(String target, KURL dest, boolean overwrite);
	/**	
		 Change permissions on <code>path</code>
		 The slave emits ERR_DOES_NOT_EXIST or ERR_CANNOT_CHMOD
		     		@short    Change permissions on <code>path</code>  The slave emits ERR_DOES_NOT_EXIST or ERR_CANNOT_CHMOD
	*/
	public native void chmod(KURL url, int permissions);
	/**	
		 Copy <code>src</code> into <code>dest.</code>
		 If the slave returns an error ERR_UNSUPPORTED_ACTION, the job will
		 ask for get + put instead.
			@param src where to copy the file from (decoded)
			@param dest where to copy the file to (decoded)
			@param permissions may be -1. In this case no special permission mode is set.
			@param overwrite if true, any existing file will be overwritten
			     		@short    Copy <code>src</code> into <code>dest.</code>
	*/
	public native void copy(KURL src, KURL dest, int permissions, boolean overwrite);
	/**	
		 Delete a file or directory.
			@param url file/directory to delete
			@param isfile if true, a file should be deleted.
		               if false, a directory should be deleted.
		     		@short    Delete a file or directory.
	*/
	public native void del(KURL url, boolean isfile);
	/**	
		 Used for any command that is specific to this slave (protocol)
		 Examples are : HTTP POST, mount and unmount (tdeio_file)
			@param data packed data; the meaning is completely dependent on the
		        slave, but usually starts with an int for the command number.
		 Document your slave's commands, at least in its header file.
		     		@short    Used for any command that is specific to this slave (protocol)  Examples are : HTTP POST, mount and unmount (tdeio_file)
	*/
	public native void special(byte[] data);
	/**	
		 Used for multiple get. Currently only used foir HTTP pielining
		 support.
			@param data packed data; Contains number of URLs to fetch, and for
		 each URL the URL itself and its associated MetaData.
		     		@short    Used for multiple get.
	*/
	public native void multiGet(byte[] data);
	/**	
		 Called to get the status of the slave. Slave should respond
		 by calling slaveStatus(...)
		     		@short    Called to get the status of the slave.
	*/
	public native void slave_status();
	/**	
		 Called by the scheduler to tell the slave that the configuration
		 changed (i.e. proxy settings) .
		     		@short    Called by the scheduler to tell the slave that the configuration  changed (i.
	*/
	public native void reparseConfiguration();
	/**	
				@return timeout value for connecting to remote host.
     
		@short
	*/
	public native int connectTimeout();
	/**	
				@return timeout value for connecting to proxy in secs.
     
		@short
	*/
	public native int proxyConnectTimeout();
	/**	
				@return timeout value for read from first data from
 remote host in seconds.
     
		@short
	*/
	public native int responseTimeout();
	/**	
				@return timeout value for read from subsequent data from
 remote host in secs.
     
		@short
	*/
	public native int readTimeout();
	/**	
		 This function sets a timeout of <code>timeout</code> seconds and calls
		 special(data) when the timeout occurs as if it was called by the
		 application.
			 A timeout can only occur when the slave is waiting for a command
		 from the application.
			 Specifying a negative timeout cancels a pending timeout.
			 Only one timeout at a time is supported, setting a timeout
		 cancels any pending timeout.
				@short    This function sets a timeout of <code>timeout</code> seconds and calls  special(data) when the timeout occurs as if it was called by the  application.
	*/
	public native void setTimeoutSpecialCommand(int timeout, byte[] data);
	public native void setTimeoutSpecialCommand(int timeout);
	/**	
			     		@short
	*/
	public native boolean dispatch();
	/**	
			     		@short
	*/
	public native void dispatch(int command, byte[] data);
	/**	
		 Read data send by the job, after a dataReq
			@param buffer buffer where data is stored
				@return 0 on end of data,
         > 0 bytes read
         < 0 error

		@short    Read data send by the job, after a dataReq
	*/
	public native int readData(byte[] buffer);
	/**	
		 internal function to be called by the slave.
		 It collects entries and emits them via listEntries
		 when enough of them are there or a certain time
		 frame exceeded (to make sure the app gets some
		 items in time but not too many items one by one
		 as this will cause a drastic performance penalty)
			@param _entry The UDSEntry containing all of the object attributes.
			@param ready set to true after emitting all items. <code>_entry</code> is not
		        used in this case
		     		@short    internal function to be called by the slave.
	*/
	// void listEntry(const TDEIO::UDSEntry& arg1,bool arg2); >>>> NOT CONVERTED
	/**	
		 internal function to connect a slave to/ disconnect from
		 either the slave pool or the application
		     		@short    internal function to connect a slave to/ disconnect from  either the slave pool or the application
	*/
	public native void connectSlave(String path);
	public native void disconnectSlave();
	/**	
		 Prompt the user for Authorization info (login & password).
			 Use this function to request authorization information from
		 the end user. You can also pass an error message which explains
		 why a previous authorization attempt failed. Here is a very
		 simple example:
			 <pre>
		 KIO.AuthInfo authInfo;
		 if ( openPassDlg( authInfo ) )
		 {
		    kdDebug() << String.fromLatin1("User: ")
		              << authInfo.username << endl;
		    kdDebug() << String.fromLatin1("Password: ")
		              << String.fromLatin1("Not displayed here!") << endl;
		 }
		 </pre>
			 You can also preset some values like the username, caption or
		 comment as follows:
			 <pre>
		 KIO.AuthInfo authInfo;
		 authInfo.caption= "Acme Password Dialog";
		 authInfo.username= "Wile E. Coyote";
		 String errorMsg = "You entered an incorrect password.";
		 if ( openPassDlg( authInfo, errorMsg ) )
		 {
		    kdDebug() << String.fromLatin1("User: ")
		              << authInfo.username << endl;
		    kdDebug() << String.fromLatin1("Password: ")
		              << String.fromLatin1("Not displayed here!") << endl;
		 }
		 </pre>
			 <b>Note:<> You should consider using checkCachedAuthentication() to
		 see if the password is available in kpasswdserver before calling
		 this function.
			 <b>Note:<> A call to this function can fail and return <code>false</code>,
		 if the UIServer could not be started for whatever reason.
			@param info See AuthInfo.
			@param errorMsg Error message to show
				@return <code>true</code> if user clicks on "OK", <code>false</code> otherwsie.

		@short    Prompt the user for Authorization info (login & password).
		@see #checkCachedAuthentication
	*/
	public native boolean openPassDlg(AuthInfo info, String errorMsg);
	/**	
		 Same as above function except it does not need error message.
		 BIC: Combine this function with the above for KDE4.
		     		@short    Same as above function except it does not need error message.
	*/
	public native boolean openPassDlg(AuthInfo info);
	/**	
		 Used by the slave to check if it can connect
		 to a given host. This should be called where the slave is ready
		 to do a .connect() on a socket. For each call to
		 requestNetwork must exist a matching call to
		 dropNetwork, or the system will stay online until
		 KNetMgr gets closed (or the SlaveBase gets destructed)!
			 If KNetMgr is not running, then this is a no-op and returns true
			@param host tells the netmgr the host the slave wants to connect
		             to. As this could also be a proxy, we can't just take
		             the host currenctly connected to (but that's the default
		             value)
				@return true in theorie, the host is reachable
         false the system is offline and the host is in a remote network.
     
		@short    Used by the slave to check if it can connect  to a given host.
	*/
	public native boolean requestNetwork(String host);
	public native boolean requestNetwork();
	/**	
		 Used by the slave to withdraw a connection requested by
		 requestNetwork. This function cancels the last call to
		 requestNetwork. If a client uses more than one internet
		 connection, it must use dropNetwork(host) to
		 stop each request.
			 If KNetMgr is not running, then this is a no-op.
			@param host the host passed to requestNetwork
			 A slave should call this function every time it disconnect from a host.
		 		@short    Used by the slave to withdraw a connection requested by  requestNetwork.
	*/
	public native void dropNetwork(String host);
	public native void dropNetwork();
	/**	
		 Return the dcop client used by this slave.
				@short    Return the dcop client used by this slave.
	*/
	public native DCOPClient dcopClient();
	/**	
		 Wait for an answer to our request, until we get <code>expected1</code> or <code>expected2</code>
				@return the result from readData, as well as the cmd in *pCmd if set, and the data in <code>data</code>
     
		@short    Wait for an answer to our request, until we get <code>expected1</code> or <code>expected2</code>
	*/
	public native int waitForAnswer(int expected1, int expected2, byte[] data, int[] pCmd);
	public native int waitForAnswer(int expected1, int expected2, byte[] data);
	/**	
		 Internal function to transmit meta data to the application.
		     		@short    Internal function to transmit meta data to the application.
	*/
	public native void sendMetaData();
	/**	 If your ioslave was killed by a signal, wasKilled() returns true.
		     Check it regularly in lengthy functions (e.g. in get();) and return
		     as fast as possible from this function if wasKilled() returns true.
		     This will ensure that your slave destructor will be called correctly.
				@short   If your ioslave was killed by a signal, wasKilled() returns true.
	*/
	public native boolean wasKilled();
	/**	 Internally used.
				@short   Internally used.
	*/
	public native void setKillFlag();
	/**	
			     		@short
	*/
	public static native void sigsegv_handler(int arg1);
	/**	
			     		@short
	*/
	public static native void sigpipe_handler(int arg1);
}