Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

mdnshandler.h

Go to the documentation of this file.
00001 
00002 /*
00003 ** Copyright (C) 2005 Russell Leighton
00004 **
00005 ** This program is free software; you can redistribute it and/or modify
00006 ** it under the terms of the GNU General Public License as published by
00007 ** the Free Software Foundation; either version 2 of the License, or
00008 ** (at your option) any later version.
00009 **
00010 ** This program is distributed in the hope that it will be useful,
00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ** GNU General Public License for more details.
00014 **
00015 ** You should have received a copy of the GNU General Public License
00016 ** along with this program; if not, write to the Free Software
00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 */
00019 
00020 
00021 
00022 
00023 #ifndef __AWHANDLER_MDNS__
00024 #define __AWHANDLER_MDNS__
00025 
00026 #include "monitor.h"
00027 
00028 #include "wire.h"
00029 
00030 #include "mDNSClientAPI.h"
00031 
00032 #include "mDNSPosix.h"
00033 
00095 typedef struct {
00096 
00097   aw_event_sig_t
00098    up,               /* service is noticed up */
00099    down;             /* service is noticed down */
00100 
00101 } aw_mdnshandler_events_t;
00102 
00106 typedef struct {
00107 
00108   /* up/down events */
00109   aw_mdnshandler_events_t
00110    events;
00111 
00112   /* stanard service name */
00113   byte_t service[sizeof(domainname)];
00114 
00115   /* protocol, if empty string will default to "tcp" */
00116   byte_t protocol[sizeof(domainname)];
00117 
00118   /* domain, if empty string will default to "local" */
00119   byte_t domain[sizeof(domainname)];
00120 
00121 } aw_mdnshandler_servicematch_t;
00122 
00123 typedef struct aw_mdnshandler_question_s aw_mdnshandler_question_t;
00124 
00128 typedef struct {
00129 
00130   aw_handler_t 
00131     handler_header;
00132 
00133   aw_mdnshandler_question_t
00134    *questions;
00135 
00136   struct {
00137 
00138     // mDNS core uses this to store its state
00139     mDNS coreStorage;           
00140 
00141     // PosixStorage
00142     mDNS_PlatformSupport platformStorage;
00143 
00144     // cache
00145     CacheRecord recordCache[500];
00146 
00147     // the absolute time we need to call mDNS_Execute() again
00148     mDNSs32 nextevent;
00149 
00150   } mdns;
00151 
00152 } aw_mdnshandler_t ;
00153 
00154 
00158 struct aw_mdnshandler_question_s {
00159 
00160   // list
00161   struct aw_mdnshandler_question_s *next;
00162 
00163   // query we are doing 
00164   DNSQuestion dnsquestion;
00165 
00166   // back pointer to handler
00167   aw_mdnshandler_t *handler;
00168 
00169   /* up/down events */
00170   aw_mdnshandler_events_t
00171    events;
00172 
00173 };
00174 
00182 aw_mdnshandler_t *aw_create_mdnshandler(u_int32_t nservicematches, 
00183                                         aw_mdnshandler_servicematch_t *servicematches,
00184                                         aw_logger_t *logger
00185                                         );
00186 
00191 void aw_free_mdnshandler(aw_mdnshandler_t *h);
00192 
00193 
00197 aw_handler_t *aw_wire_mdnshandler(aw_wire_mkhandler_args_t *args);
00198 
00199 #endif
00200 
Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)