Home | History | Annotate | Download | only in src
      1 /*
      2  *
      3  *  BlueZ - Bluetooth protocol stack for Linux
      4  *
      5  *  Copyright (C) 2005-2010  Marcel Holtmann <marcel (at) holtmann.org>
      6  *
      7  *
      8  *  This program is free software; you can redistribute it and/or modify
      9  *  it under the terms of the GNU General Public License as published by
     10  *  the Free Software Foundation; either version 2 of the License, or
     11  *  (at your option) any later version.
     12  *
     13  *  This program is distributed in the hope that it will be useful,
     14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16  *  GNU General Public License for more details.
     17  *
     18  *  You should have received a copy of the GNU General Public License
     19  *  along with this program; if not, write to the Free Software
     20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     21  *
     22  */
     23 
     24 
     25 #ifndef __SDP_XML_H
     26 #define __SDP_XML_H
     27 
     28 #include <bluetooth/sdp.h>
     29 
     30 #define SDP_XML_ENCODING_NORMAL	0
     31 #define SDP_XML_ENCODING_HEX	1
     32 
     33 void convert_sdp_record_to_xml(sdp_record_t *rec,
     34 		void *user_data, void (*append_func) (void *, const char *));
     35 
     36 sdp_data_t *sdp_xml_parse_nil(const char *data);
     37 sdp_data_t *sdp_xml_parse_text(const char *data, char encoding);
     38 sdp_data_t *sdp_xml_parse_url(const char *data);
     39 sdp_data_t *sdp_xml_parse_int(const char *data, uint8_t dtd);
     40 sdp_data_t *sdp_xml_parse_uuid(const char *data, sdp_record_t *record);
     41 
     42 struct sdp_xml_data {
     43 	char *text;			/* Pointer to the current buffer */
     44 	int size;			/* Size of the current buffer */
     45 	sdp_data_t *data;		/* The current item being built */
     46 	struct sdp_xml_data *next;	/* Next item on the stack */
     47 	char type;			/* 0 = Text or Hexadecimal */
     48 	char *name;			/* Name, optional in the dtd */
     49 	/* TODO: What is it used for? */
     50 };
     51 
     52 struct sdp_xml_data *sdp_xml_data_alloc(void);
     53 void sdp_xml_data_free(struct sdp_xml_data *elem);
     54 struct sdp_xml_data *sdp_xml_data_expand(struct sdp_xml_data *elem);
     55 
     56 sdp_data_t *sdp_xml_parse_datatype(const char *el, struct sdp_xml_data *elem,
     57 							sdp_record_t *record);
     58 
     59 #endif /* __SDP_XML_H */
     60