dns_sd.h

Go to the documentation of this file.
00001 /*##############################################################################
00002 
00003 nIP
00004 
00005 Copyright notice:
00006 
00007 Copyright (C) 2005 -
00008 Andreas Dittrich, dittrich@informatik.hu-berlin.de
00009 Jon Kowal, kowal@informatik.hu-berlin.de
00010 
00011 This program is free software; you can redistribute it and/or
00012 modify it under the terms of the GNU General Public License
00013 as published by the Free Software Foundation; either version 2
00014 of the License, or (at your option) any later version.
00015 
00016 This program is distributed in the hope that it will be useful,
00017 but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00019 GNU General Public License for more details.
00020 
00021 You should have received a copy of the GNU General Public License
00022 along with this program; if not, write to the Free Software
00023 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00024 
00025 ##############################################################################*/
00026 /** @file dns_sd.h
00027  *
00028  * DNS Services Discovery Extension.
00029  *
00030  * Provides means to register and unregister services.
00031  *
00032  */
00033 
00034 #ifndef _DNS_SD_H_
00035  #define _DNS_SD_H_
00036 
00037 #include "nip_init.h"
00038 #include "nip_types.h"
00039 #include "os_core.h"
00040 #include "mem.h"
00041 #include "app/mdns.h"
00042 
00043 #define NIP_DNSSD_NO_SERVICE   0
00044 
00045 #ifndef NIP_DNSSD_MAX_SERVICES
00046         #define NIP_DNSSD_MAX_SERVICES 1
00047 #endif
00048 
00049 
00050 #if   NIP_DNSSD_MAX_SERVIECS < 0xFF
00051         typedef uint8_t nip_dnssd_id_t;
00052 #elif NIP_DNSSD_MAX_SERVICES < 0xFFFF
00053         typedef uint16_t nip_dnssd_id_t;
00054 #else
00055         typedef uint32_t nip_dnssd_id_t;
00056 #endif
00057 
00058 struct nip_dnssd_name_srv
00059 {
00060         nip_mdns_namestring_id_t instance;
00061         nip_mdns_namestring_id_t app;
00062         nip_mdns_namestring_id_t proto;
00063         nip_mdns_namestring_id_t domain;
00064 }
00065 #ifndef DOXYGEN
00066 __attribute__((packed))
00067 #endif
00068 ;
00069 
00070 struct nip_dnssd_name_ptr
00071 {
00072         nip_mdns_namestring_id_t app;
00073         nip_mdns_namestring_id_t proto;
00074         nip_mdns_namestring_id_t domain;
00075 }
00076 #ifndef DOXYGEN
00077 __attribute__((packed))
00078 #endif
00079 ;
00080 
00081 struct nip_dnssd_name_a
00082 {
00083         nip_mdns_namestring_id_t host;
00084         nip_mdns_namestring_id_t domain;
00085 }
00086 #ifndef DOXYGEN
00087 __attribute__((packed))
00088 #endif
00089 ;
00090 
00091 struct nip_dnssd_name_txt
00092 {
00093         nip_mdns_namestring_id_t instance;
00094         nip_mdns_namestring_id_t app;
00095         nip_mdns_namestring_id_t proto;
00096         nip_mdns_namestring_id_t domain;
00097 }
00098 #ifndef DOXYGEN
00099 __attribute__((packed))
00100 #endif
00101 ;
00102 
00103 typedef union
00104 {
00105         struct nip_mdns_name      generic;
00106         struct nip_dnssd_name_a   a;
00107         struct nip_dnssd_name_srv srv;
00108         struct nip_dnssd_name_ptr ptr;
00109         struct nip_dnssd_name_txt txt;
00110 }
00111 #ifndef DOXYGEN
00112 __attribute__((packed))
00113 #endif
00114 nip_dnssd_name_t;
00115 
00116 
00117 /** Structure to hold IDs of registered DNS Records for a specific service. */
00118 struct nip_dnssd_service
00119 {
00120         nip_dnssd_id_t      id;
00121         nip_mdns_cache_id_t srv_rr; /**< SRV-record */
00122         nip_mdns_cache_id_t txt_rr; /**< TXT-record */
00123         nip_mdns_cache_id_t ptr_rr; /**< PTR-record */
00124         nip_mdns_cache_id_t dns_sd_ptr_rr; // _services._dns-sd._udp.local PTR
00125 }
00126 #ifndef DOXYGEN
00127 __attribute__((packed))
00128 #endif
00129 ;
00130 
00131 
00132 
00133 nip_dnssd_id_t nip_dnssd_register( nip_mem_ptr_t *instance, nip_mem_ptr_t *service, nip_mem_ptr_t *txt, nip_mem_size_t txtlen, uint16_t port, uint16_t priority, uint16_t weight );
00134 
00135 #endif /* _DNS_SD_H_ */

Generated on Thu Jul 10 01:09:29 2008 for NIP by  doxygen 1.5.5