1 /*
2  *  libzvbi -- Messages and basic I/O functions between
3  *             VBI proxy client & server
4  *
5  *  Copyright (C) 2003, 2004 Tom Zoerner
6  *
7  *  This library is free software; you can redistribute it and/or
8  *  modify it under the terms of the GNU Library General Public
9  *  License as published by the Free Software Foundation; either
10  *  version 2 of the License, or (at your option) any later version.
11  *
12  *  This library is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *  Library General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Library General Public
18  *  License along with this library; if not, write to the
19  *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  *  Boston, MA  02110-1301  USA.
21  */
22 
23 /*
24  *  $Id: proxy-msg.h,v 1.13 2008/02/19 00:35:21 mschimek Exp $
25  *
26  *  $Log: proxy-msg.h,v $
27  *  Revision 1.13  2008/02/19 00:35:21  mschimek
28  *  *** empty log message ***
29  *
30  *  Revision 1.12  2007/11/27 18:31:07  mschimek
31  *  Updated the FSF address in the copyright notice.
32  *
33  *  Revision 1.11  2007/11/20 21:43:46  tomzo
34  *  Improvements and corrections in the proxy API documentation.
35  *
36  *  Revision 1.10  2007/07/23 20:01:18  mschimek
37  *  *** empty log message ***
38  *
39  *  Revision 1.9  2004/10/24 18:33:47  tomzo
40  *  - cleaned up socket I/O interface functions
41  *  - added defines for norm change events
42  *
43  *  Revision 1.8  2004/10/04 20:50:24  mschimek
44  *  *** empty log message ***
45  *
46  *  Revision 1.6  2003/06/07 09:43:08  tomzo
47  *  - added new message types MSG_TYPE_DAEMON_PID_REQ,CNF
48  *  - added new struct VBIPROXY_MSG: holds message header and body structs
49  *
50  *  Revision 1.5  2003/06/01 19:36:23  tomzo
51  *  Implemented server-side TV channel switching
52  *  - implemented messages MSG_TYPE_CHN_CHANGE_REQ/CNF/REJ; IND is still TODO
53  *  - removed obsolete PROFILE messages: profile is included with CHN_CHANGE_REQ
54  *  Also: added VBI API identifier and device path to CONNECT_CNF (for future use)
55  *
56  *  Revision 1.4  2003/05/24 12:19:29  tomzo
57  *  - added VBIPROXY_SERVICE_REQ/_CNF/_REJ messages
58  *  - prepared channel change request and profile request
59  *  - renamed MSG_TYPE_DATA_IND into _SLICED_IND in preparation for raw data
60  *
61  *  Revision 1.3  2003/05/03 12:04:52  tomzo
62  *  - added new macro VBIPROXY_ENDIAN_MISMATCH to replace use of swap32()
63  *  - added declaration for new func vbi_proxy_msg_set_debug_level()
64  *  - fixed copyright headers, added description to file headers
65  *
66  */
67 
68 #ifndef PROXY_MSG_H
69 #define PROXY_MSG_H
70 
71 #include <sys/syslog.h>
72 
73 /* Public */
74 
75 /**
76  * @ingroup Proxy
77  * @brief Priority levels for channel switching (equivalent to enum v4l2_priority)
78  *
79  * These priorities are used to cooperativly resolve conflicts between
80  * channel requests of multiple capture applications.  While a capture
81  * application with a higher priority has opened a device, channel change
82  * requests of applications with lower priority will fail with error "EBUSY".
83  */
84 typedef enum
85 {
86         /**
87          * Priority level to be used for non-interactive, background data
88          * harvesting, i.e. applications which permanently run in the
89          * background (e.g. teletext cache, EPG data acquisition)
90          */
91 	VBI_CHN_PRIO_BACKGROUND  = 1,
92         /**
93          * Interactive (default): should be used when channels are changed
94          * on request of the user (e.g. TV viewer, Radio, teletext reader)
95          */
96 	VBI_CHN_PRIO_INTERACTIVE = 2,
97         /**
98          * Default priority for client which have not (yet) set a priority.
99          */
100 	VBI_CHN_PRIO_DEFAULT     = VBI_CHN_PRIO_INTERACTIVE,
101         /**
102          * Scheduled recording (e.g. PVR): usually only one application
103          * should run at this level (although this is not enforced by
104          * the proxy daemon, must be checked by the user or applications)
105          */
106 	VBI_CHN_PRIO_RECORD      = 3
107 
108 } VBI_CHN_PRIO;
109 
110 /**
111  * @ingroup Proxy
112  * @brief Sub-priorities for channel scheduling at "background" priority
113  *
114  * This enum describes recommended sub-priority levels for channel profiles.
115  * They're intended for channel switching through a VBI proxy at background
116  * priority level.  The daemon uses this priority to decide which request
117  * to grant first if there are multiple outstanding requests.  To the daemon
118  * these are just numbers (highest wins) but for successful cooperation
119  * clients need to use agree on values for similar tasks. Hence the following
120  * values are recommended:
121  */
122 typedef enum
123 {
124         /**
125          * Minimal priority level. Client will get channel control only
126          * after all other clients.
127          */
128 	VBI_CHN_SUBPRIO_MINIMAL  = 0x00,
129         /**
130          * After phases "initial" or "check" are completed, clients can use
131          * this level to continuously check for change marks.
132          */
133 	VBI_CHN_SUBPRIO_CHECK    = 0x10,
134         /**
135          * A change in the data transmission has been detected or a long
136          * time has passed since the initial reading, so data needs to be
137          * read newly.
138          */
139 	VBI_CHN_SUBPRIO_UPDATE   = 0x20,
140         /**
141          * Initial reading of data after program start (and long pause since
142          * last start); once all data is read the client should lower it's
143          * priority.
144          */
145 	VBI_CHN_SUBPRIO_INITIAL  = 0x30,
146         /**
147          * Scanning for VPS/PDC labels to wait for the start of a recording.
148          */
149 	VBI_CHN_SUBPRIO_VPS_PDC  = 0x40
150 
151 } VBI_CHN_SUBPRIO;
152 
153 /**
154  * @ingroup Proxy
155  * @brief Proxy scheduler parameters for background channel switching
156  *
157  * This structure is passed along with channel change requests for
158  * clients with priority @c VBI_CHN_PRIO_BACKGROUND.  The parameters
159  * are used by the proxy daemon to share channel control between
160  * multiple clients with background priority.
161  */
162 typedef struct
163 {
164         /**
165          * Boolean: Ignore contents of this struct unless TRUE
166          */
167 	uint8_t			is_valid;
168         /**
169          * Sub-priority for channel scheduling at "background" priority.
170          * You can use aribtrary values in the range 0 ... 256, but as
171          * this value is only meaningful in relation to priorities used
172          * by other clients, you should stick to the scale defined by
173          * @ref VBI_CHN_SUBPRIO
174          */
175 	uint8_t			sub_prio;
176         /**
177          * Boolean: Set to FALSE if your capture client needs an
178          * atomic time slice (i.e. would need to restart capturing
179          * from the beginning it it was interrupted.)
180          */
181 	uint8_t			allow_suspend;
182 
183 	uint8_t			reserved0;
184         /**
185          * Minimum time slice your capture client requires. This value
186          * is used when multiple clients have the same sub-priority
187          * to give all clients channel control in a round-robin manner.
188          */
189 	time_t			min_duration;
190         /**
191          * Expected duration of use of that channel
192          */
193 	time_t			exp_duration;
194 
195 	uint8_t			reserved1[16];
196 } vbi_channel_profile;
197 
198 /**
199  * @ingroup Proxy
200  * @brief General flags sent by the proxy daemon to clients during connect
201  */
202 typedef enum
203 {
204         /**
205          * Don't drop connection upon timeouts in socket I/O or message response;
206          * Intended for debugging, i.e. when remote party runs in a debugger
207          */
208         VBI_PROXY_DAEMON_NO_TIMEOUTS   = 1<<0
209 
210 } VBI_PROXY_DAEMON_FLAGS;
211 
212 /**
213  * @ingroup Proxy
214  * @brief General flags sent by clients to the proxy daemon during connect
215  */
216 typedef enum
217 {
218         /**
219          * Don't drop connection upon timeouts in socket I/O or message response
220          * (e.g. when waiting for connect confirm)
221          * Intended for debugging, i.e. when remote party runs in a debugger
222          */
223         VBI_PROXY_CLIENT_NO_TIMEOUTS   = 1<<0,
224         /**
225          * Suppress sending of channel change and similar indications, i.e. limit
226          * messages to slicer data forward and synchronous messages (i.e. RPC reply).
227          * Used to make sure that the proxy client socket only becomes readable
228          * when data is available for applications which are not proxy-aware.
229          */
230         VBI_PROXY_CLIENT_NO_STATUS_IND = 1<<1
231 
232 } VBI_PROXY_CLIENT_FLAGS;
233 
234 /**
235  * @ingroup Proxy
236  * @brief Channel notification flags
237  */
238 typedef enum
239 {
240         /**
241          * Revoke a previous channel request and return the channel switch
242          * token to the daemon.
243          */
244         VBI_PROXY_CHN_RELEASE = 1<<0,
245         /**
246          * Return the channel token to the daemon without releasing the
247          * channel; This should always be done when the channel switch has
248          * been completed to allow faster scheduling in the daemon (i.e. the
249          * daemon can grant the token to a different client without having
250          * to reclaim it first.)
251          */
252         VBI_PROXY_CHN_TOKEN   = 1<<1,
253         /**
254          * Indicate that the channel was changed and VBI buffer queue
255          * must be flushed; Should be called as fast as possible after
256          * the channel and/or norm was changed.  Note this affects other
257          * clients' capturing too, so use with care.  Other clients will
258          * be informed about this change by a channel change indication.
259          */
260         VBI_PROXY_CHN_FLUSH   = 1<<2,
261         /**
262          * Indicate a norm change.  The new norm should be supplied in
263          * the scanning parameter in cae the daemon is not able to
264          * determine it from the device directly.
265          */
266         VBI_PROXY_CHN_NORM    = 1<<3,
267         /**
268          * Indicate that the client failed to switch the channel because
269          * the device was busy. Used to notify the channel scheduler that
270          * the current time slice cannot be used by the client.  If the
271          * client isn't able to schedule periodic re-attempts it should
272          * also return the token.
273          */
274         VBI_PROXY_CHN_FAIL    = 1<<4,
275 
276         VBI_PROXY_CHN_NONE    = 0
277 
278 } VBI_PROXY_CHN_FLAGS;
279 
280 /**
281  * @ingroup Proxy
282  * @brief Identification of the VBI device driver type
283  */
284 typedef enum
285 {
286         /**
287          * Unknown device API - only used in error cases. Normally
288          * the proxy will always be aware of the driver API as it's
289          * determined by the type of capture context creation function
290          * used when the device is opened.
291          */
292         VBI_API_UNKNOWN,
293         /**
294          * Video4Linux version 1 (i.e. Linux kernels 2.4 or older
295          * or old device drivers which have not been ported yet)
296          */
297         VBI_API_V4L1,
298         /**
299          * Video4Linux version 2 (i.e. Linux kernels 2.6 and later)
300          */
301         VBI_API_V4L2,
302         /**
303          * BSD Brooktree capture driver.
304          */
305         VBI_API_BKTR
306 } VBI_DRIVER_API_REV;
307 
308 /**
309  * @ingroup Proxy
310  * @brief Proxy protocol version: major, minor and patchlevel
311  */
312 #define VBIPROXY_VERSION                   0x00000100
313 #define VBIPROXY_COMPAT_VERSION            0x00000100
314 
315 /* Private */
316 
317 /* ----------------------------------------------------------------------------
318 ** Declaration of message IDs and the common header struct
319 */
320 typedef enum
321 {
322    MSG_TYPE_CONNECT_REQ,
323    MSG_TYPE_CONNECT_CNF,
324    MSG_TYPE_CONNECT_REJ,
325    MSG_TYPE_CLOSE_REQ,
326 
327    MSG_TYPE_SLICED_IND,
328 
329    MSG_TYPE_SERVICE_REQ,
330    MSG_TYPE_SERVICE_CNF,
331    MSG_TYPE_SERVICE_REJ,
332 
333    MSG_TYPE_CHN_TOKEN_REQ,
334    MSG_TYPE_CHN_TOKEN_CNF,
335    MSG_TYPE_CHN_TOKEN_IND,
336    MSG_TYPE_CHN_NOTIFY_REQ,
337    MSG_TYPE_CHN_NOTIFY_CNF,
338    MSG_TYPE_CHN_RECLAIM_REQ,
339    MSG_TYPE_CHN_RECLAIM_CNF,
340    MSG_TYPE_CHN_SUSPEND_REQ,
341    MSG_TYPE_CHN_SUSPEND_CNF,
342    MSG_TYPE_CHN_SUSPEND_REJ,
343    MSG_TYPE_CHN_IOCTL_REQ,
344    MSG_TYPE_CHN_IOCTL_CNF,
345    MSG_TYPE_CHN_IOCTL_REJ,
346    MSG_TYPE_CHN_CHANGE_IND,
347 
348    MSG_TYPE_DAEMON_PID_REQ,
349    MSG_TYPE_DAEMON_PID_CNF,
350 
351    MSG_TYPE_COUNT
352 
353 } VBIPROXY_MSG_TYPE;
354 
355 typedef struct
356 {
357         uint32_t                len;
358         uint32_t                type;
359 } VBIPROXY_MSG_HEADER;
360 
361 #define VBIPROXY_MAGIC_STR                 "LIBZVBI VBIPROXY"
362 #define VBIPROXY_MAGIC_LEN                 16
363 #define VBIPROXY_ENDIAN_MAGIC              0x11223344
364 #define VBIPROXY_ENDIAN_MISMATCH           0x44332211
365 #define VBIPROXY_CLIENT_NAME_MAX_LENGTH    64
366 #define VBIPROXY_DEV_NAME_MAX_LENGTH      128
367 #define VBIPROXY_ERROR_STR_MAX_LENGTH     128
368 
369 typedef struct
370 {
371         uint8_t                 protocol_magic[VBIPROXY_MAGIC_LEN];
372         uint32_t                protocol_compat_version;
373         uint32_t                protocol_version;
374         uint32_t                endian_magic;
375 } VBIPROXY_MAGICS;
376 
377 typedef struct
378 {
379         VBIPROXY_MAGICS         magics;
380         uint8_t                 client_name[VBIPROXY_CLIENT_NAME_MAX_LENGTH];
381         int32_t                 pid;
382         uint32_t                client_flags;
383 
384         uint32_t                scanning;
385         uint8_t                 buffer_count;
386 
387         uint32_t                services;
388         int8_t                  strict;
389 
390         uint32_t                reserved[32];   /* set to zero */
391 } VBIPROXY_CONNECT_REQ;
392 
393 typedef struct
394 {
395         VBIPROXY_MAGICS         magics;
396         uint8_t                 dev_vbi_name[VBIPROXY_DEV_NAME_MAX_LENGTH];
397         int32_t                 pid;
398         uint32_t                vbi_api_revision;
399         uint32_t                daemon_flags;
400         uint32_t                services;       /* all services, including raw */
401         vbi_raw_decoder         dec;            /* VBI format, e.g. VBI line counts */
402         uint32_t                reserved[32];   /* set to zero */
403 } VBIPROXY_CONNECT_CNF;
404 
405 typedef struct
406 {
407         VBIPROXY_MAGICS         magics;
408         uint8_t                 errorstr[VBIPROXY_ERROR_STR_MAX_LENGTH];
409 } VBIPROXY_CONNECT_REJ;
410 
411 typedef struct
412 {
413         double                  timestamp;
414         uint32_t                sliced_lines;
415         uint32_t                raw_lines;
416         union
417         {
418            vbi_sliced           sliced[1];
419            int8_t               raw[1];
420         } u;
421 } VBIPROXY_SLICED_IND;
422 
423 #define VBIPROXY_RAW_LINE_SIZE        2048
424 #define VBIPROXY_SLICED_IND_SIZE(S,R) ( sizeof(VBIPROXY_SLICED_IND) \
425                                         - sizeof(vbi_sliced) \
426                                         + ((S) * sizeof(vbi_sliced)) \
427                                         + ((R) * VBIPROXY_RAW_LINE_SIZE) )
428 
429 typedef struct
430 {
431         uint8_t                 reset;
432         uint8_t                 commit;
433         int8_t                  strict;
434         uint32_t                services;
435 } VBIPROXY_SERVICE_REQ;
436 
437 typedef struct
438 {
439         uint32_t                services;       /* all services, including raw */
440         vbi_raw_decoder         dec;            /* VBI format, e.g. VBI line counts */
441 } VBIPROXY_SERVICE_CNF;
442 
443 typedef struct
444 {
445         uint8_t                 errorstr[VBIPROXY_ERROR_STR_MAX_LENGTH];
446 } VBIPROXY_SERVICE_REJ;
447 
448 typedef struct
449 {
450         uint32_t                chn_prio;
451         vbi_channel_profile     chn_profile;
452 } VBIPROXY_CHN_TOKEN_REQ;
453 
454 typedef struct
455 {
456         vbi_bool                token_ind;      /* piggy-back TOKEN_IND (bg. prio only) */
457         vbi_bool                permitted;      /* change allowed by prio (non-bg prio) */
458         vbi_bool                non_excl;       /* there are other clients at the same prio */
459 } VBIPROXY_CHN_TOKEN_CNF;
460 
461 typedef struct
462 {
463 } VBIPROXY_CHN_TOKEN_IND;
464 
465 typedef struct
466 {
467         VBI_PROXY_CHN_FLAGS     notify_flags;
468         uint32_t                scanning;       /* new norm after flush; zero if unknown */
469         uint32_t                cause;          /* currently always zero */
470         uint8_t                 reserved[32];
471 } VBIPROXY_CHN_NOTIFY_REQ;
472 
473 typedef struct
474 {
475         uint32_t                scanning;
476         uint8_t                 reserved[32];
477 } VBIPROXY_CHN_NOTIFY_CNF;
478 
479 typedef struct
480 {
481         vbi_bool                enable;
482         uint32_t                cause;
483 } VBIPROXY_CHN_SUSPEND_REQ;
484 
485 typedef struct
486 {
487 } VBIPROXY_CHN_SUSPEND_CNF;
488 
489 typedef struct
490 {
491 } VBIPROXY_CHN_SUSPEND_REJ;
492 
493 typedef struct
494 {
495         uint32_t                request;
496         uint32_t                reserved_0;
497         uint32_t                reserved_1;
498         uint32_t                arg_size;
499         uint8_t                 arg_data[0];    /* warning: must have same offset as in CNF message */
500 } VBIPROXY_CHN_IOCTL_REQ;
501 
502 #define VBIPROXY_CHN_IOCTL_REQ_SIZE(SIZE) (sizeof(VBIPROXY_CHN_IOCTL_REQ) + (SIZE) - 1)
503 
504 typedef struct
505 {
506         uint32_t                reserved_0;
507         int32_t                 result;
508         int32_t                 errcode;
509         uint32_t                arg_size;
510         uint8_t                 arg_data[0];
511 } VBIPROXY_CHN_IOCTL_CNF;
512 
513 #define VBIPROXY_CHN_IOCTL_CNF_SIZE(SIZE) (sizeof(VBIPROXY_CHN_IOCTL_CNF) + (SIZE) - 1)
514 
515 typedef struct
516 {
517 } VBIPROXY_CHN_IOCTL_REJ;
518 
519 typedef struct
520 {
521 } VBIPROXY_CHN_RECLAIM_REQ;
522 
523 typedef struct
524 {
525 } VBIPROXY_CHN_RECLAIM_CNF;
526 
527 typedef struct
528 {
529         VBI_PROXY_CHN_FLAGS     notify_flags;
530         uint32_t                scanning;
531         uint8_t                 reserved[32];   /* always zero */
532 } VBIPROXY_CHN_CHANGE_IND;
533 
534 typedef struct
535 {
536         VBIPROXY_MAGICS         magics;
537 } VBIPROXY_DAEMON_PID_REQ;
538 
539 typedef struct
540 {
541         VBIPROXY_MAGICS         magics;
542         int32_t                 pid;
543 } VBIPROXY_DAEMON_PID_CNF;
544 
545 typedef union
546 {
547         VBIPROXY_CONNECT_REQ            connect_req;
548         VBIPROXY_CONNECT_CNF            connect_cnf;
549         VBIPROXY_CONNECT_REJ            connect_rej;
550 
551         VBIPROXY_SLICED_IND             sliced_ind;
552 
553         VBIPROXY_SERVICE_REQ            service_req;
554         VBIPROXY_SERVICE_CNF            service_cnf;
555         VBIPROXY_SERVICE_REJ            service_rej;
556 
557         VBIPROXY_CHN_TOKEN_REQ          chn_token_req;
558         VBIPROXY_CHN_TOKEN_CNF          chn_token_cnf;
559         VBIPROXY_CHN_TOKEN_IND          chn_token_ind;
560         VBIPROXY_CHN_RECLAIM_REQ        chn_reclaim_req;
561         VBIPROXY_CHN_RECLAIM_CNF        chn_reclaim_cnf;
562         VBIPROXY_CHN_NOTIFY_REQ         chn_notify_req;
563         VBIPROXY_CHN_NOTIFY_CNF         chn_notify_cnf;
564         VBIPROXY_CHN_SUSPEND_REQ        chn_suspend_req;
565         VBIPROXY_CHN_SUSPEND_CNF        chn_suspend_cnf;
566         VBIPROXY_CHN_SUSPEND_REJ        chn_suspend_rej;
567         VBIPROXY_CHN_IOCTL_REQ          chn_ioctl_req;
568         VBIPROXY_CHN_IOCTL_CNF          chn_ioctl_cnf;
569         VBIPROXY_CHN_IOCTL_REJ          chn_ioctl_rej;
570         VBIPROXY_CHN_CHANGE_IND         chn_change_ind;
571 
572         VBIPROXY_DAEMON_PID_REQ         daemon_pid_req;
573         VBIPROXY_DAEMON_PID_CNF         daemon_pid_cnf;
574 
575 } VBIPROXY_MSG_BODY;
576 
577 typedef struct
578 {
579         VBIPROXY_MSG_HEADER             head;
580         VBIPROXY_MSG_BODY               body;
581 } VBIPROXY_MSG;
582 
583 #define VBIPROXY_MSG_BODY_OFFSET   ((long)&(((VBIPROXY_MSG*)NULL)->body))
584 
585 /* ----------------------------------------------------------------------------
586 ** Declaration of the IO state struct
587 */
588 typedef struct
589 {
590         int                     sock_fd;        /* socket file handle or -1 if closed */
591         time_t                  lastIoTime;     /* timestamp of last i/o (for timeouts) */
592 
593         uint32_t                writeLen;       /* number of bytes in write buffer, including header */
594         uint32_t                writeOff;       /* number of already written bytes, including header */
595         VBIPROXY_MSG          * pWriteBuf;      /* data to be written */
596         vbi_bool                freeWriteBuf;   /* TRUE if the buffer shall be freed by the I/O handler */
597 
598         uint32_t                readLen;        /* length of incoming message (including itself) */
599         uint32_t                readOff;        /* number of already read bytes */
600 } VBIPROXY_MSG_STATE;
601 
602 /* ----------------------------------------------------------------------------
603 ** Declaration of the service interface functions
604 */
605 void     vbi_proxy_msg_logger( int level, int clnt_fd, int errCode, const char * pText, ... );
606 void     vbi_proxy_msg_set_logging( vbi_bool do_logtty, int sysloglev,
607                                     int fileloglev, const char * pLogfileName );
608 void     vbi_proxy_msg_set_debug_level( int level );
609 const char * vbi_proxy_msg_debug_get_type_str( VBIPROXY_MSG_TYPE type );
610 
611 vbi_bool vbi_proxy_msg_read_idle( VBIPROXY_MSG_STATE * pIO );
612 vbi_bool vbi_proxy_msg_write_idle( VBIPROXY_MSG_STATE * pIO );
613 vbi_bool vbi_proxy_msg_is_idle( VBIPROXY_MSG_STATE * pIO );
614 vbi_bool vbi_proxy_msg_check_timeout( VBIPROXY_MSG_STATE * pIO, time_t now );
615 vbi_bool vbi_proxy_msg_handle_write( VBIPROXY_MSG_STATE * pIO, vbi_bool * pBlocked );
616 void     vbi_proxy_msg_close_read( VBIPROXY_MSG_STATE * pIO );
617 vbi_bool vbi_proxy_msg_handle_read( VBIPROXY_MSG_STATE * pIO,
618                                     vbi_bool * pBlocked, vbi_bool closeOnZeroRead,
619                                     VBIPROXY_MSG * pReadBuf, int max_read_len );
620 void     vbi_proxy_msg_close_io( VBIPROXY_MSG_STATE * pIO );
621 void     vbi_proxy_msg_fill_magics( VBIPROXY_MAGICS * p_magic );
622 void     vbi_proxy_msg_write( VBIPROXY_MSG_STATE * p_io, VBIPROXY_MSG_TYPE type,
623                               uint32_t msgLen, VBIPROXY_MSG * pMsg, vbi_bool freeBuf );
624 
625 int      vbi_proxy_msg_listen_socket( vbi_bool is_tcp_ip, const char * listen_ip, const char * listen_port );
626 void     vbi_proxy_msg_stop_listen( vbi_bool is_tcp_ip, int sock_fd, char * pSrvPort );
627 int      vbi_proxy_msg_accept_connection( int listen_fd );
628 char   * vbi_proxy_msg_get_socket_name( const char * p_dev_name );
629 vbi_bool vbi_proxy_msg_check_connect( const char * p_sock_path );
630 int      vbi_proxy_msg_connect_to_server( vbi_bool use_tcp_ip, const char * pSrvHost, const char * pSrvPort, char ** ppErrorText );
631 vbi_bool vbi_proxy_msg_finish_connect( int sock_fd, char ** ppErrorText );
632 
633 int      vbi_proxy_msg_check_ioctl( VBI_DRIVER_API_REV vbi_api,
634                                     int request, void * p_arg, vbi_bool * req_perm );
635 
636 #endif  /* PROXY_MSG_H */
637 
638 /*
639 Local variables:
640 c-set-style: K&R
641 c-basic-offset: 8
642 End:
643 */
644