to the taller of the two subtrees of*/ if (shortened_side == 1) { q = p->left; } else { q = p->right; } if (AVL_GET_BALANCE (q) == 0) { /* case 3a: height unchanged */ if (shortened_side == -1) { /* single rotate left */ q->parent = p->parent; p->right = q->left; if (q->left) { q->left->parent = p; } q->left = p; p->parent = q; AVL_SET_RANK (q, (AVL_GET_RANK (q) + AVL_GET_RANK (p))); } else { /* single rotate right */ q->parent = p->parent; p->left = q->right; if (q->right) { q->right->parent = p; } q->right = p; p->parent = q; AVL_SET_RANK (p, (AVL_GET_RANK (p) - AVL_GET_RANK (q))); } shorter = 0; AVL_SET_BALANCE (q, shortened_side); AVL_SET_BALANCE (p, (- shortened_side)); } else if (AVL_GET_BALANCE (q) == AVL_GET_BALANCE (p)) { /* case 3b: height reduced */ if (shortened_side == -1) { /* single rotate left */ q->parent = p->parent; p->right = q->left; if (q->left) { q->left->parent = p; } q->left = p; p->parent = q; AVL_SET_RANK (q, (AVL_GET_RANK (q) + AVL_GET_RANK (p))); } else { /* single rotate right */ q->parent = p->parent; p->left = q->right; if (q->right) { q->right->parent = p; } q->right = p; p->parent = q; AVL_SET_RANK (p, (AVL_GET_RANK (p) - AVL_GET_RANK (q))); } shorter = 1; AVL_SET_BALANCE (q, 0); AVL_SET_BALANCE (p, 0); } else { /* case 3c: height reduced, balance factors opposite */ if (shortened_side == 1) { /* double rotate right */ /* first, a left rotation around q */ r = q->right; r->parent = p->parent; q->right = r->left; if (r->left) { r->left->parent = q; } r->left = q; q->parent = r; /* now, a right rotation around p */ p->left = r->right; if (r->right) { r->right->parent = p; } r->right = p; p->parent = r; AVL_SET_RANK (r, (AVL_GET_RANK (r) + AVL_GET_RANK (q))); AVL_SET_RANK (p, (AVL_GET_RANK (p) - AVL_GET_RANK (r))); } else { /* double rotate left */ /* first, a right rotation around q */ r = q->left; r->parent = p->parent; q->left = r->right; if (r->right) { r->right->parent = q; } r->right = q; q->parent = r; /* now a left rotation around p */ p->right = r->left; if (r->left) { r->left->parent = p; } r->left = p; p->parent = r; AVL_SET_RANK (q, (AVL_GET_RANK (q) - AVL_GET_RANK (r))); AVL_SET_RANK (r, (AVL_GET_RANK (r) + AVL_GET_RANK (p))); } if (AVL_GET_BALANCE (r) == shortened_side) { AVL_SET_BALANCE (q, (- shortened_side)); AVL_SET_BALANCE (p, 0); } else if (AVL_GET_BALANCE (r) == (- shortened_side)) { AVL_SET_BALANCE (q, 0); AVL_SET_BALANCE (p, shortened_side); } else { AVL_SET_BALANCE (q, 0); AVL_SET_BALANCE (p, 0); } AVL_SET_BALANCE (r, 0); q = r; } /* a rotation has caused
(orin case 3c) to become * the root. let 's former parent know this. */ if (top->left == p) { top->left = q; } else { top->right = q; } /* end case 3 */ p = q; } x = p; p = x->parent; /* shortened_side tells us which side we came up from */ if (x == p->left) { shortened_side = -1; } else { shortened_side = +1; } } /* end while(shorter) */ /* when we're all done, we're one shorter */ tree->length = tree->length - 1; return (0); } static int avl_iterate_inorder_helper (avl_node * node, avl_iter_fun_type iter_fun, void * iter_arg) { int result; if (node->left) { result = avl_iterate_inorder_helper (node->left, iter_fun, iter_arg); if (result != 0) { return result; } } result = (iter_fun (node->key, iter_arg)); if (result != 0) { return result; } if (node->right) { result = avl_iterate_inorder_helper (node->right, iter_fun, iter_arg); if (result != 0) { return result; } } return 0; } int avl_iterate_inorder (avl_tree * tree, avl_iter_fun_type iter_fun, void * iter_arg) { int result; if (tree->length) { result = avl_iterate_inorder_helper (tree->root->right, iter_fun, iter_arg); return (result); } else { return 0; } } avl_node *avl_get_first(avl_tree *tree) { avl_node *node; node = tree->root->right; if (node == NULL || node->key == NULL) return NULL; while (node->left) node = node->left; return node; } avl_node *avl_get_prev(avl_node *node) { if (node->left) { node = node->left; while (node->right) { node = node->right; } return node; } else { avl_node *child = node; while (node->parent && node->parent->key) { node = node->parent; if (child == node->right) { return node; } child = node; } return NULL; } } avl_node *avl_get_next(avl_node *node) { if (node->right) { node = node->right; while (node->left) { node = node->left; } return node; } else { avl_node *child = node; while (node->parent && node->parent->key) { node = node->parent; if (child == node->left) { return node; } child = node; } return NULL; } } /* iterate a function over a range of indices, using get_predecessor */ int avl_iterate_index_range (avl_tree * tree, avl_iter_index_fun_type iter_fun, unsigned long low, unsigned long high, void * iter_arg) { unsigned long m; unsigned long num_left; avl_node * node; if (high > tree->length) { return -1; } num_left = (high - low); /* find the
th node */ m = high; node = tree->root->right; while (1) { if (m < AVL_GET_RANK (node)) { node = node->left; } else if (m > AVL_GET_RANK (node)) { m = m - AVL_GET_RANK (node); node = node->right; } else { break; } } /* call on , , ... */ while (num_left) { num_left = num_left - 1; if (iter_fun (num_left, node->key, iter_arg) != 0) { return -1; } node = avl_get_prev (node); } return 0; } /* If is present in the tree, return that key's node, and set <*index> * appropriately. If not, return NULL, and set <*index> to the position * representing the closest preceding value. */ static avl_node * avl_get_index_by_key (avl_tree * tree, void * key, unsigned long * index) { avl_node * x = tree->root->right; unsigned long m; if (!x) { return NULL; } m = AVL_GET_RANK (x); while (1) { int compare_result = tree->compare_fun (tree->compare_arg, key, x->key); if (compare_result < 0) { if (x->left) { m = m - AVL_GET_RANK(x); x = x->left; m = m + AVL_GET_RANK(x); } else { *index = m - 2; return NULL; } } else if (compare_result > 0) { if (x->right) { x = x->right; m = m + AVL_GET_RANK(x); } else { *index = m - 1; return NULL; } } else { *index = m - 1; return x; } } } /* return the (low index, high index) pair that spans the given key */ int avl_get_span_by_key (avl_tree * tree, void * key, unsigned long * low, unsigned long * high) { unsigned long m, i, j; avl_node * node; node = avl_get_index_by_key (tree, key, &m); /* did we find an exact match? * if so, we have to search left and right * to find the span, since we know nothing about * the arrangement of like keys. */ if (node) { avl_node * left, * right; /* search left */ left = avl_get_prev (node); i = m; while (left && (i > 0) && (tree->compare_fun (tree->compare_arg, key, left->key) == 0)) { left = avl_get_prev (left); i = i - 1; } /* search right */ right = avl_get_next (node); j = m; while (right && (j <= tree->length) && (tree->compare_fun (tree->compare_arg, key, right->key) == 0)) { right = avl_get_next (right); j = j + 1; } *low = i; *high = j + 1; return 0; } else { *low = *high = m; } return 0; } /* return the (low index, high index) pair that spans the given key */ int avl_get_span_by_two_keys (avl_tree * tree, void * low_key, void * high_key, unsigned long * low, unsigned long * high) { unsigned long i, j; avl_node * low_node, * high_node; int order; /* we may need to swap them */ order = tree->compare_fun (tree->compare_arg, low_key, high_key); if (order > 0) { void * temp = low_key; low_key = high_key; high_key = temp; } low_node = avl_get_index_by_key (tree, low_key, &i); high_node = avl_get_index_by_key (tree, high_key, &j); if (low_node) { avl_node * left; /* search left */ left = avl_get_prev (low_node); while (left && (i > 0) && (tree->compare_fun (tree->compare_arg, low_key, left->key) == 0)) { left = avl_get_prev (left); i = i - 1; } } else { i = i + 1; } if (high_node) { avl_node * right; /* search right */ right = avl_get_next (high_node); while (right && (j <= tree->length) && (tree->compare_fun (tree->compare_arg, high_key, right->key) == 0)) { right = avl_get_next (right); j = j + 1; } } else { j = j + 1; } *low = i; *high = j; return 0; } int avl_get_item_by_key_most (avl_tree * tree, void * key, void **value_address) { avl_node * x = tree->root->right; *value_address = NULL; if (!x) { return -1; } while (1) { int compare_result = tree->compare_fun (tree->compare_arg, key, x->key); if (compare_result == 0) { *value_address = x->key; return 0; } else if (compare_result < 0) { /* the given key is less than the current key */ if (x->left) { x = x->left; } else { if (*value_address) return 0; else return -1; } } else { /* the given key is more than the current key */ /* save this value, it might end up being the right one! */ *value_address = x->key; if (x->right) { /* there is a bigger entry */ x = x->right; } else { if (*value_address) return 0; else return -1; } } } } int avl_get_item_by_key_least (avl_tree * tree, void * key, void **value_address) { avl_node * x = tree->root->right; *value_address = NULL; if (!x) { return -1; } while (1) { int compare_result = tree->compare_fun (tree->compare_arg, key, x->key); if (compare_result == 0) { *value_address = x->key; return 0; /* exact match */ } else if (compare_result < 0) { /* the given key is less than the current key */ /* save this value, it might end up being the right one! */ *value_address = x->key; if (x->left) { x = x->left; } else { if (*value_address) /* we have found a valid entry */ return 0; else return -1; } } else { if (x->right) { /* there is a bigger entry */ x = x->right; } else { if (*value_address) /* we have found a valid entry */ return 0; else return -1; } } } } #define AVL_MAX(X, Y) ((X) > (Y) ? (X) : (Y)) static long avl_verify_balance (avl_node * node) { if (!node) { return 0; } else { long lh = avl_verify_balance (node->left); long rh = avl_verify_balance (node->right); if ((rh - lh) != AVL_GET_BALANCE(node)) { return 0; } if (((lh - rh) > 1) || ((lh - rh) < -1)) { return 0; } return (1 + AVL_MAX (lh, rh)); } } static void avl_verify_parent (avl_node * node, avl_node * parent) { if (node->parent != parent) { return; } if (node->left) { avl_verify_parent (node->left, node); } if (node->right) { avl_verify_parent (node->right, node); } } static long avl_verify_rank (avl_node * node) { if (!node) { return 0; } else { unsigned long num_left=0, num_right=0; if (node->left) { num_left = avl_verify_rank (node->left); } if (node->right) { num_right = avl_verify_rank (node->right); } if (AVL_GET_RANK (node) != num_left + 1) { fprintf (stderr, "invalid rank at node %ld\n", (long) node->key); exit (1); } return (num_left + num_right + 1); } } /* sanity-check the tree */ int avl_verify (avl_tree * tree) { if (tree->length) { avl_verify_balance (tree->root->right); avl_verify_parent (tree->root->right, tree->root); avl_verify_rank (tree->root->right); } return (0); } /* * These structures are accumulated on the stack during print_tree * and are used to keep track of the width and direction of each * branch in the history of a particular line . */ typedef struct _link_node { struct _link_node * parent; char direction; int width; } link_node; static char balance_chars[3] = {'\\', '-', '/'}; static int default_key_printer (char * buffer, void * key) { return snprintf (buffer, AVL_KEY_PRINTER_BUFLEN, "%p", key); } /* * When traveling the family tree, a change in direction * indicates when to print a connector. This is kinda crazy, * we use the stack to build a linked list, and then travel * it backwards using recursion. */ static void print_connectors (link_node * link) { if (link->parent) { print_connectors (link->parent); } if (link->parent && (link->parent->direction != link->direction) && (link->parent->parent)) { int i; fprintf (stdout, "|"); for (i=0; i < (link->width - 1); i++) { fprintf (stdout, " "); } } else { int i; for (i=0; i < (link->width); i++) { fprintf (stdout, " "); } } } /* * The function writes a representation of the * key into (which is conveniently fixed in size to add * the spice of danger). It should return the size of the * representation. */ static void print_node (avl_key_printer_fun_type key_printer, avl_node * node, link_node * link) { char buffer[AVL_KEY_PRINTER_BUFLEN]; unsigned int width; width = key_printer (buffer, node->key); if (node->right) { link_node here; here.parent = link; here.direction = 1; here.width = width + 11; print_node (key_printer, node->right, &here); } print_connectors (link); fprintf (stdout, "+-[%c %s %03d]", balance_chars[AVL_GET_BALANCE(node)+1], buffer, (int)AVL_GET_RANK(node)); if (node->left || node->right) { fprintf (stdout, "-|\n"); } else { fprintf (stdout, "\n"); } if (node->left) { link_node here; here.parent = link; here.direction = -1; here.width = width + 11; print_node (key_printer, node->left, &here); } } void avl_print_tree (avl_tree * tree, avl_key_printer_fun_type key_printer) { link_node top = {NULL, 0, 0}; if (!key_printer) { key_printer = default_key_printer; } if (tree->length) { print_node (key_printer, tree->root->right, &top); } else { fprintf (stdout, " \n"); } } void avl_tree_rlock(avl_tree *tree) { thread_rwlock_rlock(&tree->rwlock); } void avl_tree_wlock(avl_tree *tree) { thread_rwlock_wlock(&tree->rwlock); } void avl_tree_unlock(avl_tree *tree) { thread_rwlock_unlock(&tree->rwlock); } #ifdef HAVE_AVL_NODE_LOCK void avl_node_rlock(avl_node *node) { thread_rwlock_rlock(&node->rwlock); } void avl_node_wlock(avl_node *node) { thread_rwlock_wlock(&node->rwlock); } void avl_node_unlock(avl_node *node) { thread_rwlock_unlock(&node->rwlock); } #endif libshout-idjc-2.4.1/src/common/avl/TODO 0000644 0001750 0001750 00000000062 12630630405 014525 0000000 0000000 - avl_get_last() - a little more cleanup probably libshout-idjc-2.4.1/src/common/avl/README 0000644 0001750 0001750 00000000170 12630630405 014715 0000000 0000000 this is the avl tree library. lgpl by sam rushing modified by jack moffitt libshout-idjc-2.4.1/src/common/avl/COPYING 0000644 0001750 0001750 00000061273 12630630405 015103 0000000 0000000 GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! libshout-idjc-2.4.1/src/common/avl/Makefile.in 0000644 0001750 0001750 00000047746 12713141243 016125 0000000 0000000 # Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/common/avl ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ $(top_srcdir)/m4/speex.m4 $(top_srcdir)/m4/theora.m4 \ $(top_srcdir)/m4/vorbis.m4 $(top_srcdir)/m4/xiph_compiler.m4 \ $(top_srcdir)/m4/xiph_net.m4 $(top_srcdir)/m4/xiph_openssl.m4 \ $(top_srcdir)/m4/xiph_types.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libiceavl_la_LIBADD = am_libiceavl_la_OBJECTS = libiceavl_la-avl.lo libiceavl_la_OBJECTS = $(am_libiceavl_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libiceavl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libiceavl_la_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libiceavl_la_SOURCES) DIST_SOURCES = $(libiceavl_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp COPYING \ README TODO DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LDFLAGS = @OGG_LDFLAGS@ OGG_LIBS = @OGG_LIBS@ OGG_PREFIX = @OGG_PREFIX@ OPT = @OPT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKGCONFIG = @PKGCONFIG@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROFILE = @PROFILE@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CPPFLAGS = @PTHREAD_CPPFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SHOUT_CFLAGS = @SHOUT_CFLAGS@ SHOUT_CPPFLAGS = @SHOUT_CPPFLAGS@ SHOUT_LIBDEPS = @SHOUT_LIBDEPS@ SHOUT_REQUIRES = @SHOUT_REQUIRES@ SHOUT_THREADSAFE = @SHOUT_THREADSAFE@ SHOUT_TLS = @SHOUT_TLS@ SPEEX = @SPEEX@ SPEEX_CFLAGS = @SPEEX_CFLAGS@ SPEEX_LDFLAGS = @SPEEX_LDFLAGS@ SPEEX_LIBS = @SPEEX_LIBS@ STRIP = @STRIP@ THEORA = @THEORA@ THEORA_CFLAGS = @THEORA_CFLAGS@ THEORA_LDFLAGS = @THEORA_LDFLAGS@ THEORA_LIBS = @THEORA_LIBS@ VERSION = @VERSION@ VORBISENC_LIBS = @VORBISENC_LIBS@ VORBISFILE_LIBS = @VORBISFILE_LIBS@ VORBIS_CFLAGS = @VORBIS_CFLAGS@ VORBIS_LDFLAGS = @VORBIS_LDFLAGS@ VORBIS_LIBS = @VORBIS_LIBS@ VORBIS_PREFIX = @VORBIS_PREFIX@ XIPH_CFLAGS = @XIPH_CFLAGS@ XIPH_CPPFLAGS = @XIPH_CPPFLAGS@ XIPH_LIBS = @XIPH_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign EXTRA_DIST = BUILDING COPYING README TODO avl.dsp test.c noinst_LTLIBRARIES = libiceavl.la noinst_HEADERS = avl.h libiceavl_la_SOURCES = avl.c libiceavl_la_CFLAGS = @XIPH_CFLAGS@ -I$(srcdir)/.. all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/common/avl/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/common/avl/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libiceavl.la: $(libiceavl_la_OBJECTS) $(libiceavl_la_DEPENDENCIES) $(EXTRA_libiceavl_la_DEPENDENCIES) $(AM_V_CCLD)$(libiceavl_la_LINK) $(libiceavl_la_OBJECTS) $(libiceavl_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libiceavl_la-avl.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< libiceavl_la-avl.lo: avl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libiceavl_la_CFLAGS) $(CFLAGS) -MT libiceavl_la-avl.lo -MD -MP -MF $(DEPDIR)/libiceavl_la-avl.Tpo -c -o libiceavl_la-avl.lo `test -f 'avl.c' || echo '$(srcdir)/'`avl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libiceavl_la-avl.Tpo $(DEPDIR)/libiceavl_la-avl.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='avl.c' object='libiceavl_la-avl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libiceavl_la_CFLAGS) $(CFLAGS) -c -o libiceavl_la-avl.lo `test -f 'avl.c' || echo '$(srcdir)/'`avl.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile debug: $(MAKE) all CFLAGS="@DEBUG@" profile: $(MAKE) all CFLAGS="@PROFILE@" # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: libshout-idjc-2.4.1/src/common/avl/avl.h 0000644 0001750 0001750 00000012476 12630630405 015004 0000000 0000000 /* * Copyright (C) 1995 by Sam Rushing */ /* $Id: avl.h,v 1.7 2003/07/07 01:10:14 brendan Exp $ */ #ifndef __AVL_H #define __AVL_H #ifdef __cplusplus extern "C" { #endif #define AVL_KEY_PRINTER_BUFLEN (256) #ifndef NO_THREAD #include "thread/thread.h" #else #define thread_rwlock_create(x) do{}while(0) #define thread_rwlock_destroy(x) do{}while(0) #define thread_rwlock_rlock(x) do{}while(0) #define thread_rwlock_wlock(x) do{}while(0) #define thread_rwlock_unlock(x) do{}while(0) #endif typedef struct avl_node_tag { void * key; struct avl_node_tag * left; struct avl_node_tag * right; struct avl_node_tag * parent; /* * The lower 2 bits of specify the balance * factor: 00==-1, 01==0, 10==+1. * The rest of the bits are used for */ unsigned int rank_and_balance; #if !defined(NO_THREAD) && defined(HAVE_AVL_NODE_LOCK) rwlock_t rwlock; #endif } avl_node; #define AVL_GET_BALANCE(n) ((int)(((n)->rank_and_balance & 3) - 1)) #define AVL_GET_RANK(n) (((n)->rank_and_balance >> 2)) #define AVL_SET_BALANCE(n,b) \ ((n)->rank_and_balance) = \ (((n)->rank_and_balance & (~3)) | ((int)((b) + 1))) #define AVL_SET_RANK(n,r) \ ((n)->rank_and_balance) = \ (((n)->rank_and_balance & 3) | (r << 2)) struct _avl_tree; typedef int (*avl_key_compare_fun_type) (void * compare_arg, void * a, void * b); typedef int (*avl_iter_fun_type) (void * key, void * iter_arg); typedef int (*avl_iter_index_fun_type) (unsigned long index, void * key, void * iter_arg); typedef int (*avl_free_key_fun_type) (void * key); typedef int (*avl_key_printer_fun_type) (char *, void *); /* * and let us associate a particular compare * function with each tree, separately. */ #ifdef _mangle # define avl_tree_new _mangle(avl_tree_new) # define avl_node_new _mangle(avl_node_new) # define avl_tree_free _mangle(avl_tree_free) # define avl_insert _mangle(avl_insert) # define avl_delete _mangle(avl_delete) # define avl_get_by_index _mangle(avl_get_by_index) # define avl_get_by_key _mangle(avl_get_by_key) # define avl_iterate_inorder _mangle(avl_iterate_inorder) # define avl_iterate_index_range _mangle(avl_iterate_index_range) # define avl_tree_rlock _mangle(avl_tree_rlock) # define avl_tree_wlock _mangle(avl_tree_wlock) # define avl_tree_wlock _mangle(avl_tree_wlock) # define avl_tree_unlock _mangle(avl_tree_unlock) # define avl_node_rlock _mangle(avl_node_rlock) # define avl_node_wlock _mangle(avl_node_wlock) # define avl_node_unlock _mangle(avl_node_unlock) # define avl_get_span_by_key _mangle(avl_get_span_by_key) # define avl_get_span_by_two_keys _mangle(avl_get_span_by_two_keys) # define avl_verify _mangle(avl_verify) # define avl_print_tree _mangle(avl_print_tree) # define avl_get_first _mangle(avl_get_first) # define avl_get_prev _mangle(avl_get_prev) # define avl_get_next _mangle(avl_get_next) # define avl_get_item_by_key_most _mangle(avl_get_item_by_key_most) # define avl_get_item_by_key_least _mangle(avl_get_item_by_key_least) #endif typedef struct _avl_tree { avl_node * root; unsigned int height; unsigned int length; avl_key_compare_fun_type compare_fun; void * compare_arg; #ifndef NO_THREAD rwlock_t rwlock; #endif } avl_tree; avl_tree * avl_tree_new (avl_key_compare_fun_type compare_fun, void * compare_arg); avl_node * avl_node_new (void * key, avl_node * parent); void avl_tree_free ( avl_tree * tree, avl_free_key_fun_type free_key_fun ); int avl_insert ( avl_tree * ob, void * key ); int avl_delete ( avl_tree * tree, void * key, avl_free_key_fun_type free_key_fun ); int avl_get_by_index ( avl_tree * tree, unsigned long index, void ** value_address ); int avl_get_by_key ( avl_tree * tree, void * key, void ** value_address ); int avl_iterate_inorder ( avl_tree * tree, avl_iter_fun_type iter_fun, void * iter_arg ); int avl_iterate_index_range ( avl_tree * tree, avl_iter_index_fun_type iter_fun, unsigned long low, unsigned long high, void * iter_arg ); int avl_get_span_by_key ( avl_tree * tree, void * key, unsigned long * low, unsigned long * high ); int avl_get_span_by_two_keys ( avl_tree * tree, void * key_a, void * key_b, unsigned long * low, unsigned long * high ); int avl_verify (avl_tree * tree); void avl_print_tree ( avl_tree * tree, avl_key_printer_fun_type key_printer ); avl_node *avl_get_first(avl_tree *tree); avl_node *avl_get_prev(avl_node * node); avl_node *avl_get_next(avl_node * node); /* These two are from David Ascher */ int avl_get_item_by_key_most ( avl_tree * tree, void * key, void ** value_address ); int avl_get_item_by_key_least ( avl_tree * tree, void * key, void ** value_address ); /* optional locking stuff */ void avl_tree_rlock(avl_tree *tree); void avl_tree_wlock(avl_tree *tree); void avl_tree_unlock(avl_tree *tree); void avl_node_rlock(avl_node *node); void avl_node_wlock(avl_node *node); void avl_node_unlock(avl_node *node); #ifdef __cplusplus } #endif #endif /* __AVL_H */ libshout-idjc-2.4.1/src/common/avl/Makefile.am 0000644 0001750 0001750 00000000545 12631271614 016103 0000000 0000000 ## Process this with automake to create Makefile.in AUTOMAKE_OPTIONS = foreign EXTRA_DIST = BUILDING COPYING README TODO avl.dsp test.c noinst_LTLIBRARIES = libiceavl.la noinst_HEADERS = avl.h libiceavl_la_SOURCES = avl.c libiceavl_la_CFLAGS = @XIPH_CFLAGS@ -I$(srcdir)/.. debug: $(MAKE) all CFLAGS="@DEBUG@" profile: $(MAKE) all CFLAGS="@PROFILE@" libshout-idjc-2.4.1/src/tls.c 0000644 0001750 0001750 00000013702 12631271614 012742 0000000 0000000 /* -*- c-basic-offset: 8; -*- */ /* tls.c: TLS support functions * $Id$ * * Copyright (C) 2015 Philipp Schafft * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include #endif #include #include "shout_private.h" #ifndef XXX_HAVE_X509_check_host #include #endif struct _shout_tls { SSL_CTX *ssl_ctx; SSL *ssl; int ssl_ret; /* only pointers into self, don't need to free them */ sock_t socket; const char *host; const char *ca_directory; const char *ca_file; const char *allowed_ciphers; const char *client_certificate; }; shout_tls_t *shout_tls_new(shout_t *self, sock_t socket) { shout_tls_t *tls = calloc(1, sizeof(shout_tls_t)); if (!tls) return NULL; tls->socket = socket; tls->host = self->host; tls->ca_directory = self->ca_directory; tls->ca_file = self->ca_file; tls->allowed_ciphers = self->allowed_ciphers; tls->client_certificate = self->client_certificate; return tls; } static inline int tls_setup(shout_tls_t *tls) { const SSL_METHOD *meth; SSL_library_init(); SSL_load_error_strings(); SSLeay_add_all_algorithms(); SSLeay_add_ssl_algorithms(); meth = TLSv1_client_method(); if (!meth) goto error; tls->ssl_ctx = SSL_CTX_new(meth); if (!tls->ssl_ctx) goto error; SSL_CTX_set_default_verify_paths(tls->ssl_ctx); SSL_CTX_load_verify_locations(tls->ssl_ctx, tls->ca_file, tls->ca_directory); SSL_CTX_set_verify(tls->ssl_ctx, SSL_VERIFY_NONE, NULL); if (tls->client_certificate) { if (SSL_CTX_use_certificate_file(tls->ssl_ctx, tls->client_certificate, SSL_FILETYPE_PEM) != 1) goto error; if (SSL_CTX_use_PrivateKey_file(tls->ssl_ctx, tls->client_certificate, SSL_FILETYPE_PEM) != 1) goto error; } if (SSL_CTX_set_cipher_list(tls->ssl_ctx, tls->allowed_ciphers) <= 0) goto error; SSL_CTX_set_mode(tls->ssl_ctx, SSL_MODE_ENABLE_PARTIAL_WRITE); SSL_CTX_set_mode(tls->ssl_ctx, SSL_MODE_AUTO_RETRY); tls->ssl = SSL_new(tls->ssl_ctx); if (!tls->ssl) goto error; if (!SSL_set_fd(tls->ssl, tls->socket)) goto error; SSL_set_tlsext_host_name(tls->ssl, tls->host); SSL_set_connect_state(tls->ssl); tls->ssl_ret = SSL_connect(tls->ssl); return SHOUTERR_SUCCESS; error: if (tls->ssl) SSL_free(tls->ssl); if (tls->ssl_ctx) SSL_CTX_free(tls->ssl_ctx); return SHOUTERR_UNSUPPORTED; } #ifndef XXX_HAVE_X509_check_host static inline int tls_check_pattern(const char *key, const char *pattern) { for (; *key && *pattern; key++) { if (*pattern == '*') { for (; *pattern == '*'; pattern++); for (; *key && *key != '.'; key++); if (!*pattern && !*key) return 1; if (!*pattern || !*key) return 0; } if (tolower(*key) != tolower(*pattern)) return 0; pattern++; } return *key == 0 && *pattern == 0; } static inline int tls_check_host(X509 *cert, const char *hostname) { char common_name[256] = ""; X509_NAME *xname = X509_get_subject_name(cert); X509_NAME_ENTRY *xentry; ASN1_STRING *sdata; int i, j; int ret; ret = X509_NAME_get_text_by_NID(xname, NID_commonName, common_name, sizeof(common_name)); if (ret < 1 || (size_t)ret >= (sizeof(common_name)-1)) return SHOUTERR_TLSBADCERT; if (!tls_check_pattern(hostname, common_name)) return SHOUTERR_TLSBADCERT; /* check for inlined \0, see https://www.blackhat.com/html/bh-usa-09/bh-usa-09-archives.html#Marlinspike */ for (i = -1; ; i = j) { j = X509_NAME_get_index_by_NID(xname, NID_commonName, i); if (j == -1) break; } xentry = X509_NAME_get_entry(xname, i); sdata = X509_NAME_ENTRY_get_data(xentry); if ((size_t)ASN1_STRING_length(sdata) != strlen(common_name)) return SHOUTERR_TLSBADCERT; return SHOUTERR_SUCCESS; } #endif static inline int tls_check_cert(shout_tls_t *tls) { X509 *cert = SSL_get_peer_certificate(tls->ssl); int cert_ok = 0; if (!cert) return SHOUTERR_TLSBADCERT; do { if (SSL_get_verify_result(tls->ssl) != X509_V_OK) break; #ifdef XXX_HAVE_X509_check_host if (X509_check_host(cert, tls->host, 0, 0, NULL) != 1) break; #else if (tls_check_host(cert, tls->host) != SHOUTERR_SUCCESS) break; #endif /* ok, all test passed... */ cert_ok = 1; } while (0); X509_free(cert); return cert_ok ? SHOUTERR_SUCCESS : SHOUTERR_TLSBADCERT; } static inline int tls_setup_process(shout_tls_t *tls) { if (SSL_is_init_finished(tls->ssl)) return tls_check_cert(tls); tls->ssl_ret = SSL_connect(tls->ssl); if (SSL_is_init_finished(tls->ssl)) return tls_check_cert(tls); return SHOUTERR_BUSY; } int shout_tls_try_connect(shout_tls_t *tls) { if (!tls->ssl) tls_setup(tls); if (tls->ssl) return tls_setup_process(tls); return SHOUTERR_UNSUPPORTED; } int shout_tls_close(shout_tls_t *tls) { if (tls->ssl) { SSL_shutdown(tls->ssl); SSL_free(tls->ssl); } if (tls->ssl_ctx) SSL_CTX_free(tls->ssl_ctx); free(tls); return SHOUTERR_SUCCESS; } ssize_t shout_tls_read(shout_tls_t *tls, void *buf, size_t len) { return tls->ssl_ret = SSL_read(tls->ssl, buf, len); } ssize_t shout_tls_write(shout_tls_t *tls, const void *buf, size_t len) { return tls->ssl_ret = SSL_write(tls->ssl, buf, len); } int shout_tls_recoverable(shout_tls_t *tls) { int error = SSL_get_error(tls->ssl, tls->ssl_ret); if (error == SSL_ERROR_WANT_READ || error == SSL_ERROR_WANT_WRITE) return 1; return 0; } libshout-idjc-2.4.1/src/codec_speex.c 0000644 0001750 0001750 00000004561 12630630405 014420 0000000 0000000 /* -*- c-basic-offset: 8; -*- */ /* speex.c: Ogg Speex data handlers for libshout * * Copyright (C) 2005 the Icecast team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include "shout_private.h" #include "format_ogg.h" /* -- local data structures -- */ typedef struct { SpeexHeader *sh; } speex_data_t; /* -- local prototypes -- */ static int read_speex_page(ogg_codec_t *codec, ogg_page *page); static void free_speex_data(void *codec_data); /* -- speex functions -- */ int _shout_open_speex(ogg_codec_t *codec, ogg_page *page) { speex_data_t *speex_data = calloc(1, sizeof(speex_data_t)); ogg_packet packet; (void)page; if (!speex_data) return SHOUTERR_MALLOC; ogg_stream_packetout(&codec->os, &packet); if (!(speex_data->sh = speex_packet_to_header((char*)packet.packet,packet.bytes))) { free_speex_data(speex_data); return SHOUTERR_UNSUPPORTED; } codec->codec_data = speex_data; codec->read_page = read_speex_page; codec->free_data = free_speex_data; return SHOUTERR_SUCCESS; } static int read_speex_page(ogg_codec_t *codec, ogg_page *page) { ogg_packet packet; speex_data_t *speex_data = codec->codec_data; uint64_t samples = 0; (void)page; while (ogg_stream_packetout (&codec->os, &packet) > 0) samples += speex_data->sh->frames_per_packet * speex_data->sh->frame_size; codec->senttime += ((samples * 1000000) / speex_data->sh->rate); return SHOUTERR_SUCCESS; } static void free_speex_data(void *codec_data) { speex_data_t *speex_data = (speex_data_t *)codec_data; if (speex_data->sh) free(speex_data->sh); free(speex_data); } libshout-idjc-2.4.1/src/codec_theora.c 0000644 0001750 0001750 00000010065 12630630405 014552 0000000 0000000 /* -*- c-basic-offset: 8; -*- */ /* theora.c: Ogg Theora data handlers for libshout * $Id$ * * Copyright (C) 2004 the Icecast team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #include #include #include "shout_private.h" #include "format_ogg.h" /* -- local data structures -- */ typedef struct { theora_info ti; theora_comment tc; uint32_t granule_shift; double per_frame; uint64_t start_frame; int initial_frames; int get_start_frame; } theora_data_t; /* -- local prototypes -- */ static int read_theora_page(ogg_codec_t *codec, ogg_page *page); static void free_theora_data(void *codec_data); static int theora_ilog(unsigned int v); /* -- theora functions -- */ int _shout_open_theora(ogg_codec_t *codec, ogg_page *page) { ogg_packet packet; (void)page; theora_data_t *theora_data = calloc(1, sizeof(theora_data_t)); if (! theora_data) return SHOUTERR_MALLOC; theora_info_init(&theora_data->ti); theora_comment_init(&theora_data->tc); ogg_stream_packetout(&codec->os, &packet); if (theora_decode_header(&theora_data->ti, &theora_data->tc, &packet) < 0) { free_theora_data(theora_data); return SHOUTERR_UNSUPPORTED; } codec->codec_data = theora_data; codec->read_page = read_theora_page; codec->free_data = free_theora_data; codec->headers = 1; theora_data->initial_frames = 0; return SHOUTERR_SUCCESS; } static int read_theora_page(ogg_codec_t *codec, ogg_page *page) { theora_data_t *theora_data = codec->codec_data; ogg_packet packet; ogg_int64_t granulepos, iframe, pframe; granulepos = ogg_page_granulepos(page); if (granulepos == 0) { while (ogg_stream_packetout(&codec->os, &packet) > 0) { if (theora_decode_header(&theora_data->ti, &theora_data->tc, &packet) < 0) return SHOUTERR_INSANE; codec->headers++; } if (codec->headers == 3) { theora_data->granule_shift = theora_ilog(theora_data->ti.keyframe_frequency_force - 1); theora_data->per_frame = (double)theora_data->ti.fps_denominator / theora_data->ti.fps_numerator * 1000000; theora_data->get_start_frame = 1; } return SHOUTERR_SUCCESS; } while (ogg_stream_packetout(&codec->os, &packet) > 0) { if (theora_data->get_start_frame) theora_data->initial_frames++; } if (granulepos > 0 && codec->headers >= 3) { iframe = granulepos >> theora_data->granule_shift; pframe = granulepos - (iframe << theora_data->granule_shift); if (theora_data->get_start_frame) { /* work out the real start frame, which may not be 0 */ theora_data->start_frame = iframe + pframe - theora_data->initial_frames; codec->senttime = 0; theora_data->get_start_frame = 0; } else { uint64_t frames = ((iframe + pframe) - theora_data->start_frame); codec->senttime = (uint64_t)(frames * theora_data->per_frame); } } return SHOUTERR_SUCCESS; } static void free_theora_data(void *codec_data) { theora_data_t *theora_data = (theora_data_t *)codec_data; theora_info_clear(&theora_data->ti); theora_comment_clear(&theora_data->tc); free(theora_data); } static int theora_ilog(unsigned int v) { int ret = 0; while (v) { ret++; v >>= 1; } return ret; } libshout-idjc-2.4.1/src/codec_opus.c 0000644 0001750 0001750 00000016455 12630630405 014267 0000000 0000000 /* -*- c-basic-offset: 8; -*- */ /* opus.c: Ogg Opus data handlers for libshout * * Copyright (C) 2005 the Icecast team * Copyright (C) 2011,2012 Xiph.Org Foundation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include #endif #ifdef HAVE_INTTYPES_H #include #endif #include #include #include "shout_private.h" #include "format_ogg.h" /* -- local data structures -- */ typedef struct { int version; int channels; /* Number of channels: 1..255 */ int preskip; uint32_t input_sample_rate; int gain; /* in dB S7.8 should be zero whenever possible */ int channel_mapping; /* The rest is only used if channel_mapping != 0 */ int nb_streams; int nb_coupled; unsigned char stream_map[255]; } OpusHeader; typedef struct { OpusHeader oh; int skipped; } opus_data_t; typedef struct { const unsigned char *data; int maxlen; int pos; } ROPacket; /* -- local prototypes -- */ static int read_opus_page(ogg_codec_t *codec, ogg_page *page); static void free_opus_data(void *codec_data); static int opus_header_parse(const unsigned char *header, int len, OpusHeader *h); /* -- header functions -- */ static int read_uint32(ROPacket *p, uint32_t *val) { if (p->pos>p->maxlen-4) return 0; *val = (uint32_t)p->data[p->pos ]; *val |= (uint32_t)p->data[p->pos+1]<< 8; *val |= (uint32_t)p->data[p->pos+2]<<16; *val |= (uint32_t)p->data[p->pos+3]<<24; p->pos += 4; return 1; } static int read_uint16(ROPacket *p, uint16_t *val) { if (p->pos>p->maxlen-2) return 0; *val = (uint16_t)p->data[p->pos ]; *val |= (uint16_t)p->data[p->pos+1]<<8; p->pos += 2; return 1; } static int read_chars(ROPacket *p, unsigned char *str, int nb_chars) { int i; if (p->pos>p->maxlen-nb_chars) return 0; for (i=0;i data[p->pos++]; return 1; } static int opus_header_parse(const unsigned char *packet, int len, OpusHeader *h) { int i; char str[9]; ROPacket p; unsigned char ch; uint16_t shortval; p.data = packet; p.maxlen = len; p.pos = 0; str[8] = 0; if(len<19)return 0; read_chars(&p, (unsigned char*)str, 8); if (strcmp(str, "OpusHead")!=0) return 0; if (!read_chars(&p, &ch, 1)) return 0; h->version = ch; if((h->version&240) != 0) /* Only major version 0 supported. */ return 0; if (!read_chars(&p, &ch, 1)) return 0; h->channels = ch; if (h->channels == 0) return 0; if (!read_uint16(&p, &shortval)) return 0; h->preskip = shortval; if (!read_uint32(&p, &h->input_sample_rate)) return 0; if (!read_uint16(&p, &shortval)) return 0; h->gain = (short)shortval; if (!read_chars(&p, &ch, 1)) return 0; h->channel_mapping = ch; if (h->channel_mapping != 0) { if (!read_chars(&p, &ch, 1)) return 0; h->nb_streams = ch; if (!read_chars(&p, &ch, 1)) return 0; h->nb_coupled = ch; /* Multi-stream support */ for (i=0;i channels;i++) { if (!read_chars(&p, &h->stream_map[i], 1)) return 0; } } else { h->nb_streams = 1; h->nb_coupled = h->channels>1; h->stream_map[0]=0; h->stream_map[1]=1; } /*For version 0/1 we know there won't be any more data so reject any that have data past the end.*/ if ((h->version==0 || h->version==1) && p.pos != len) return 0; return 1; } /* From libopus, src/opus_decode.c */ static int packet_get_samples_per_frame(const unsigned char *data, int32_t Fs) { int audiosize; if (data[0]&0x80) { audiosize = ((data[0]>>3)&0x3); audiosize = (Fs< >3)&0x3); if (audiosize == 3) audiosize = Fs*60/1000; else audiosize = (Fs< os, &packet); if (!opus_header_parse(packet.packet,packet.bytes,&opus_data->oh)) { free_opus_data(opus_data); return SHOUTERR_UNSUPPORTED; } opus_data->skipped = 0; codec->codec_data = opus_data; codec->read_page = read_opus_page; codec->free_data = free_opus_data; return SHOUTERR_SUCCESS; } static int read_opus_page(ogg_codec_t *codec, ogg_page *page) { ogg_packet packet; opus_data_t *opus_data = codec->codec_data; (void)page; /* We use the strategy of counting the packet times and ignoring the granpos. This has the advantage of needing less code to sanely handle non-zero starttimes and slightly saner behavior on files with holes. */ while (ogg_stream_packetout (&codec->os, &packet) > 0){ if(packet.bytes>0 && (packet.bytes<2 || memcmp(packet.packet, "Op",2)!=0)){ int32_t spf; spf = packet_get_samples_per_frame(packet.packet,48000); if(spf>0){ int32_t spp; spp=packet_get_nb_frames(packet.packet,packet.bytes); if(spp>0){ int needskip; needskip=opus_data->oh.preskip-opus_data->skipped; spp*=spf; /*Opus files can begin with some frames which are just there to prime the decoder and are not played these should just be sent as fast as we get them.*/ if(needskip>0){ int skip; skip = spp skipped+=skip; } codec->senttime += ((spp * 1000000ULL) / 48000ULL); } }else if (packet.bytes>=19 && memcmp(packet.packet, "OpusHead",8)==0){ /* We appear to be chaining, reset skip to burst the pregap. */ if(opus_header_parse(packet.packet,packet.bytes,&opus_data->oh)) opus_data->skipped=0; } } } return SHOUTERR_SUCCESS; } static void free_opus_data(void *codec_data) { free(codec_data); } libshout-idjc-2.4.1/src/codec_vorbis.c 0000644 0001750 0001750 00000006133 12630630405 014575 0000000 0000000 /* -*- c-basic-offset: 8; -*- */ /* vorbis.c: Ogg Vorbis data handlers for libshout * $Id$ * * Copyright (C) 2002-2004 the Icecast team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include #endif #ifdef HAVE_INTTYPES_H #include #endif #include #include #include "shout_private.h" #include "format_ogg.h" /* -- local data structures -- */ typedef struct { vorbis_info vi; vorbis_comment vc; int prevW; } vorbis_data_t; /* -- local prototypes -- */ static int read_vorbis_page(ogg_codec_t *codec, ogg_page *page); static void free_vorbis_data(void *codec_data); static int vorbis_blocksize(vorbis_data_t *vd, ogg_packet *p); /* -- vorbis functions -- */ int _shout_open_vorbis(ogg_codec_t *codec, ogg_page *page) { vorbis_data_t *vorbis_data = calloc(1, sizeof(vorbis_data_t)); ogg_packet packet; (void)page; if (!vorbis_data) return SHOUTERR_MALLOC; vorbis_info_init(&vorbis_data->vi); vorbis_comment_init(&vorbis_data->vc); ogg_stream_packetout(&codec->os, &packet); if (vorbis_synthesis_headerin(&vorbis_data->vi, &vorbis_data->vc, &packet) < 0) { free_vorbis_data(vorbis_data); return SHOUTERR_UNSUPPORTED; } codec->codec_data = vorbis_data; codec->read_page = read_vorbis_page; codec->free_data = free_vorbis_data; return SHOUTERR_SUCCESS; } static int read_vorbis_page(ogg_codec_t *codec, ogg_page *page) { ogg_packet packet; vorbis_data_t *vorbis_data = codec->codec_data; uint64_t samples = 0; (void)page; if (codec->headers < 3) { while (ogg_stream_packetout (&codec->os, &packet) > 0) { if (vorbis_synthesis_headerin(&vorbis_data->vi, &vorbis_data->vc, &packet) < 0) return SHOUTERR_INSANE; codec->headers++; } return SHOUTERR_SUCCESS; } while (ogg_stream_packetout (&codec->os, &packet) > 0) samples += vorbis_blocksize(vorbis_data, &packet); codec->senttime += ((samples * 1000000) / vorbis_data->vi.rate); return SHOUTERR_SUCCESS; } static void free_vorbis_data(void *codec_data) { vorbis_data_t *vorbis_data = (vorbis_data_t *)codec_data; vorbis_info_clear(&vorbis_data->vi); vorbis_comment_clear(&vorbis_data->vc); free(vorbis_data); } static int vorbis_blocksize(vorbis_data_t *vd, ogg_packet *p) { int this = vorbis_packet_blocksize(&vd->vi, p); int ret = (this + vd->prevW)/4; if(!vd->prevW) { vd->prevW = this; return 0; } vd->prevW = this; return ret; } libshout-idjc-2.4.1/src/format_mpeg.c 0000644 0001750 0001750 00000026631 12631271614 014445 0000000 0000000 /* -*- c-basic-offset: 8; -*- */ /* mpeg.c: mpeg format handlers for libshout * * Copyright (C) 2012 Stephen Fairchild * Copyright (C) 2002-2003 the Icecast team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "shout_private.h" /* -- header sizes -- */ #define LAYER3_HEADER_SIZE (4) #define MAX_ADTS_HEADER_SIZE (9) #define MIN_ADTS_HEADER_SIZE (7) /* -- header structures -- */ typedef struct { unsigned int samplerate; unsigned int samples; unsigned int framesize; /* physical size in bytes */ } mpeg_header_t; typedef struct { int syncword; /* always 0xFFF */ int version; /* 0 for mpeg4, 1 for mpeg 2 */ int layer; /* always 0 */ int protection_absent; int profile; /* the mpeg audio object type minus 1 */ int samplerate_index; int private_stream; int channel_configuration; int originality; int home; int copyrighted_stream; int copyright_start; int buffer_fullness; int extra_frames; /* number of additional aac frames (RDBs) */ } adts_header_t; typedef struct { int syncword; int layer; int version; int error_protection; int bitrate_index; int samplerate_index; int padding; int extension; int mode; int mode_ext; int copyright; int original; int emphasis; int stereo; int bitrate; int slotsize; } mp3_header_t; /* -- local state -- */ typedef struct { /* running count of number of frames processed */ unsigned int frames; /* the number of samples for the current frame */ int frame_samples; /* the samplerate of the current frame */ int frame_samplerate; /* how many bytes for the rest of this frame */ unsigned int frame_left; /* is the header bridged?? */ int header_bridges; /* put part of header here if it spans a boundary */ unsigned char *header_bridge; /* the size of the parsed part of the header */ int header_size; /* the reader to use */ int (*header_read)(const uint8_t *window, mpeg_header_t *mh); } mpeg_data_t; /* -- static prototypes -- */ static int open_mpeg(shout_t *self, size_t header_size, int (*reader)(const uint8_t *, mpeg_header_t *)); static int send_mpeg(shout_t *self, const unsigned char *buff, size_t len); static void close_mpeg(shout_t *self); static void parse_adts_header(adts_header_t *h, mpeg_header_t *mh, const uint8_t *window); static int adts_header(const uint8_t *window, mpeg_header_t *mh); static void parse_mp3_header(mp3_header_t *h, mpeg_header_t *mh, const uint8_t *window); static int mp3_header(const uint8_t *window, mpeg_header_t *mh); int shout_open_adts(shout_t *self) { return open_mpeg(self, MIN_ADTS_HEADER_SIZE, adts_header); } int shout_open_mp3(shout_t *self) { return open_mpeg(self, LAYER3_HEADER_SIZE, mp3_header); } static int open_mpeg(shout_t *self, size_t header_size, int (*reader)(const uint8_t *, mpeg_header_t *)) { mpeg_data_t *mpeg_data; if (!(mpeg_data = (mpeg_data_t *)calloc(1, sizeof(mpeg_data_t)))) return SHOUTERR_MALLOC; if (!(mpeg_data->header_bridge = (unsigned char *)malloc(header_size - 1))) return SHOUTERR_MALLOC; self->format_data = mpeg_data; self->send = send_mpeg; self->close = close_mpeg; mpeg_data->header_size = header_size; mpeg_data->header_read = reader; return SHOUTERR_SUCCESS; } static int send_mpeg(shout_t *self, const unsigned char *buff, size_t len) { mpeg_data_t* mpeg_data = (mpeg_data_t*) self->format_data; unsigned long pos; int ret, count; int start, end, error, i; unsigned char *bridge_buff; mpeg_header_t mh; bridge_buff = NULL; pos = 0; start = 0; error = 0; end = len - 1; /* finish the previous frame */ if (mpeg_data->frame_left > 0) { /* is the rest of the frame here? */ if (mpeg_data->frame_left <= len) { self->senttime += (int64_t)((double)mpeg_data->frame_samples / (double)mpeg_data->frame_samplerate * 1000000.0); mpeg_data->frames++; pos += mpeg_data->frame_left; mpeg_data->frame_left = 0; } else { mpeg_data->frame_left -= len; pos = len; } } /* header was over the boundary, so build a new build a new buffer */ if (mpeg_data->header_bridges) { bridge_buff = (unsigned char *)malloc(len + mpeg_data->header_bridges); if (bridge_buff == NULL) { return self->error = SHOUTERR_MALLOC; } memcpy(bridge_buff, mpeg_data->header_bridge, mpeg_data->header_bridges); memcpy(&bridge_buff[mpeg_data->header_bridges], buff, len); buff = bridge_buff; len += mpeg_data->header_bridges; end = len - 1; mpeg_data->header_bridges = 0; } /** this is the main loop *** we handle everything except the last few bytes... **/ while ((pos + mpeg_data->header_size) <= len) { /* is this a valid header? */ if (mpeg_data->header_read(&buff[pos], &mh)) { if (error) { start = pos; end = len - 1; error = 0; } mpeg_data->frame_samples = mh.samples; mpeg_data->frame_samplerate = mh.samplerate; /* do we have a complete frame in this buffer? */ if (len - pos >= mh.framesize) { self->senttime += (int64_t)((double)mpeg_data->frame_samples / (double)mpeg_data->frame_samplerate * 1000000.0); mpeg_data->frames++; pos += mh.framesize; } else { mpeg_data->frame_left = mh.framesize - (len - pos); pos = len; } } else { /* there was an error ** so we send all the valid data up to this point */ if (!error) { error = 1; end = pos - 1; count = end - start + 1; if (count > 0) ret = (int)shout_send_raw(self, (unsigned char *)&buff[start], count); else ret = 0; if (ret != count) { if (bridge_buff != NULL) free(bridge_buff); return self->error = SHOUTERR_SOCKET; } } pos++; } } /* catch the tail if there is one */ if ((pos > (len - mpeg_data->header_size)) && (pos < len)) { end = pos - 1; i = 0; while (pos < len) { mpeg_data->header_bridge[i] = buff[pos]; pos++; i++; } mpeg_data->header_bridges = i; } if (!error) { /* if there are no errors, send the frames */ count = end - start + 1; if (count > 0) ret = (int)shout_send_raw(self, (unsigned char *)&buff[start], count); else ret = 0; if (bridge_buff != NULL) free(bridge_buff); if (ret == count) { return self->error = SHOUTERR_SUCCESS; } else { return self->error = SHOUTERR_SOCKET; } } if (bridge_buff != NULL) free(bridge_buff); return self->error = SHOUTERR_SUCCESS; } static void close_mpeg(shout_t *self) { mpeg_data_t *mpeg_data = (mpeg_data_t *)self->format_data; free(mpeg_data->header_bridge); free(mpeg_data); } /* -- adts/aac frame parsing stuff -- */ static void parse_adts_header(adts_header_t *h, mpeg_header_t *mh, const uint8_t *window) { static const unsigned int samplerate[16] = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350, 0, 0, 0 }; h->syncword = (int)window[0] << 4 | window[1] >> 4; h->layer = window[1] >> 1 & 0x3; h->protection_absent = window[1] & 0x1; h->samplerate_index = window[2] >> 2 & 0xf; h->extra_frames = window[6] & 0x3; mh->samplerate = samplerate[h->samplerate_index]; mh->samples = 1024 * (1 + h->extra_frames); mh->framesize = ((int)window[3] << 11 | (int)window[4] << 3 | window[5] >> 5) & 0x1fff; /* -- unused values -- */ #if 0 h->version = window[1] >> 3 & 0x1; h->profile = window[2] >> 6; h->private_stream = window[2] >> 1 & 0x1; h->channel_configuration = ((int)window[2] << 2 | window[3] >> 6) & 0x7; h->originality = window[3] >> 5 & 0x1; h->home = window[3] >> 4 & 0x1; h->copyrighted_stream = window[3] >> 3 & 0x1; h->copyright_start = window[3] >> 2 & 0x1; h->buffer_fullness = ((int)window[5] << 6 | window[6] >> 2) & 0x7ff; #endif } static int adts_header(const uint8_t *window, mpeg_header_t *mh) { adts_header_t h; /* fill out the header structs */ parse_adts_header(&h, mh, window); /* check for syncword */ if (h.syncword != 0xfff) return 0; /* check that layer is valid */ if (h.layer != 0) return 0; /* make sure sample rate is sane */ if (mh->samplerate == 0) return 0; /* make sure frame length is sane */ if (mh->framesize < (h.protection_absent ? MIN_ADTS_HEADER_SIZE : MAX_ADTS_HEADER_SIZE)) return 0; return 1; } /* -- mp3 frame parsing stuff -- */ static void parse_mp3_header(mp3_header_t *h, mpeg_header_t *mh, const uint8_t *window) { static const unsigned int bitrate[3][3][16] = { { { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0 }, { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0 }, { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0 } }, { { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0 }, { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 } }, { { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0 }, { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 } } }; static const unsigned int samplerate[3][4] = { { 44100, 48000, 32000, 0 }, { 22050, 24000, 16000, 0 }, { 11025, 12000, 8000, 0 } }; static const unsigned int samples[3][4] = { { 384, 1152, 1152, 0 }, { 384, 1152, 576, 0 }, { 384, 1152, 576, 0 } }; static const unsigned int slotsize[4] = { 4, 1, 1, 0 }; uint32_t head = (window[0] << 24) | (window[1] << 16) | (window[2] << 8) | (window[3]); h->syncword = (head >> 20) & 0xfff; h->version = ((head >> 19) & 0x1) ? 0 : 1; if ((h->syncword & 0x1) == 0) h->version = 2; h->layer = 3 - ((head >> 17) & 0x3); h->error_protection = ((head >> 16) & 0x1) ? 0 : 1; h->bitrate_index = (head >> 12) & 0xf; h->samplerate_index = (head >> 10) & 0x3; h->padding = (head >> 9) & 0x1; h->extension = (head >> 8) & 0x1; h->mode = (head >> 6) & 0x3; h->mode_ext = (head >> 4) & 0x3; h->copyright = (head >> 3) & 0x1; h->original = (head >> 2) & 0x1; h->emphasis = head & 0x3; h->stereo = (h->mode == 3) ? 1 : 2; h->bitrate = bitrate[h->version][h->layer][h->bitrate_index]; h->slotsize = slotsize[h->layer]; mh->samplerate = samplerate[h->version][h->samplerate_index]; mh->samples = samples[h->version][h->layer]; if (mh->samplerate && h->slotsize) mh->framesize = (mh->samples * h->bitrate * 1000 / (8 * mh->samplerate * h->slotsize)) * h->slotsize + h->padding; } static int mp3_header(const uint8_t *window, mpeg_header_t *mh) { mp3_header_t h; /* fill out the header struct */ parse_mp3_header(&h, mh, window); /* check for syncword */ if ((h.syncword & 0xffe) != 0xffe) return 0; /* check that layer is valid */ if (h.layer == 0) return 0; /* make sure bitrate is sane */ if (h.bitrate == 0) return 0; /* make sure samplerate is sane */ if (mh->samplerate == 0) return 0; return 1; } libshout-idjc-2.4.1/src/format_webm.c 0000644 0001750 0001750 00000003423 12631271614 014441 0000000 0000000 /* -*- c-basic-offset: 8; -*- */ /* webm.c: WebM data handler * $Id$ * * Copyright (C) 2002-2012 the Icecast team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include #endif #include #include #ifdef HAVE_INTTYPES_H #include #endif #include #include "shout_private.h" /* -- local datatypes -- */ /* no local state */ /* -- static prototypes -- */ static int send_webm(shout_t *self, const unsigned char *data, size_t len); static void close_webm(shout_t *self); int shout_open_webm(shout_t *self) { self->format_data = NULL; self->send = send_webm; self->close = close_webm; return SHOUTERR_SUCCESS; } static int send_webm(shout_t *self, const unsigned char *data, size_t len) { /* IMPORTANT TODO: we just send the raw data. We need throttling. */ ssize_t ret = shout_send_raw(self, data, len); if (ret != (ssize_t)len) return self->error = SHOUTERR_SOCKET; return self->error = SHOUTERR_SUCCESS; } static void close_webm(shout_t *self) { /* no local state */ (void)self; } libshout-idjc-2.4.1/src/format_ogg.c 0000644 0001750 0001750 00000011420 12631271614 014257 0000000 0000000 /* -*- c-basic-offset: 8; -*- */ /* ogg.c: Generic ogg data handler * $Id$ * * Copyright (C) 2002-2004 the Icecast team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include #endif #include #include #ifdef HAVE_INTTYPES_H #include #endif #include #include #include "shout_private.h" #include "format_ogg.h" /* -- local datatypes -- */ typedef struct { ogg_sync_state oy; ogg_codec_t *codecs; char bos; } ogg_data_t; /* -- static prototypes -- */ static int send_ogg(shout_t *self, const unsigned char *data, size_t len); static void close_ogg(shout_t *self); static int open_codec(ogg_codec_t *codec, ogg_page *page); static void free_codec(ogg_codec_t *codec); static void free_codecs(ogg_data_t *ogg_data); static int send_page(shout_t *self, ogg_page *page); typedef int (*codec_open_t)(ogg_codec_t *codec, ogg_page *page); static codec_open_t codecs[] = { _shout_open_vorbis, #ifdef HAVE_THEORA _shout_open_theora, #endif _shout_open_opus, #ifdef HAVE_SPEEX _shout_open_speex, #endif NULL }; int shout_open_ogg(shout_t *self) { ogg_data_t *ogg_data; if (!(ogg_data = (ogg_data_t *)calloc(1, sizeof(ogg_data_t)))) return self->error = SHOUTERR_MALLOC; self->format_data = ogg_data; ogg_sync_init(&ogg_data->oy); ogg_data->bos = 1; self->send = send_ogg; self->close = close_ogg; return SHOUTERR_SUCCESS; } static int send_ogg(shout_t *self, const unsigned char *data, size_t len) { ogg_data_t *ogg_data = (ogg_data_t *)self->format_data; ogg_codec_t *codec; char *buffer; ogg_page page; buffer = ogg_sync_buffer(&ogg_data->oy, len); memcpy(buffer, data, len); ogg_sync_wrote(&ogg_data->oy, len); while (ogg_sync_pageout(&ogg_data->oy, &page) == 1) { if (ogg_page_bos (&page)) { if (! ogg_data->bos) { free_codecs(ogg_data); ogg_data->bos = 1; } codec = calloc(1, sizeof(ogg_codec_t)); if (! codec) return self->error = SHOUTERR_MALLOC; if ((self->error = open_codec(codec, &page)) != SHOUTERR_SUCCESS) return self->error; codec->headers = 1; codec->senttime = self->senttime; codec->next = ogg_data->codecs; ogg_data->codecs = codec; } else { ogg_data->bos = 0; codec = ogg_data->codecs; while (codec) { if (ogg_page_serialno(&page) == codec->os.serialno) { if (codec->read_page) { ogg_stream_pagein(&codec->os, &page); codec->read_page(codec, &page); if (self->senttime < codec->senttime) self->senttime = codec->senttime; } break; } codec = codec->next; } } if ((self->error = send_page(self, &page)) != SHOUTERR_SUCCESS) return self->error; } return self->error = SHOUTERR_SUCCESS; } static void close_ogg(shout_t *self) { ogg_data_t *ogg_data = (ogg_data_t *)self->format_data; free_codecs(ogg_data); ogg_sync_clear(&ogg_data->oy); free(ogg_data); } static int open_codec(ogg_codec_t *codec, ogg_page *page) { codec_open_t this_codec; int i = 0; while ((this_codec = codecs[i])) { ogg_stream_init(&codec->os, ogg_page_serialno(page)); ogg_stream_pagein(&codec->os, page); if (this_codec(codec, page) == SHOUTERR_SUCCESS) return SHOUTERR_SUCCESS; ogg_stream_clear(&codec->os); i++; } /* if no handler is found, we currently just fall back to untimed send_raw */ return SHOUTERR_SUCCESS; } static void free_codecs(ogg_data_t *ogg_data) { ogg_codec_t *codec, *next; if (ogg_data == NULL) return; codec = ogg_data->codecs; while (codec) { next = codec->next; free_codec(codec); codec = next; } ogg_data->codecs = NULL; } static void free_codec(ogg_codec_t *codec) { if (codec->free_data) codec->free_data(codec->codec_data); ogg_stream_clear(&codec->os); free(codec); } static int send_page(shout_t *self, ogg_page *page) { int ret; ret = shout_send_raw(self, page->header, page->header_len); if (ret != page->header_len) return self->error = SHOUTERR_SOCKET; ret = shout_send_raw(self, page->body, page->body_len); if (ret != page->body_len) return self->error = SHOUTERR_SOCKET; return SHOUTERR_SUCCESS; } libshout-idjc-2.4.1/src/proto_roaraudio.c 0000644 0001750 0001750 00000020674 12631271614 015356 0000000 0000000 /* -*- c-basic-offset: 8; -*- */ /* proto_roaraudio.c: RoarAudio protocol support. * $Id$ * * Copyright (C) 2015 Philipp "ph3-der-loewe" Schafft * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_INTTYPES_H #include #endif /* for htonl(). */ #include #include #include #include #include #include "shout_private.h" typedef enum { STATE_IDENT = 0, STATE_AUTH, STATE_NEW_STREAM, STATE_EXEC } shout_roar_protocol_state_t; typedef enum { CMD_IDENTIFY = 1, CMD_AUTH = 2, CMD_NEW_STREAM = 3, CMD_EXEC_STREAM = 5, CMD_OK = 254 } shout_roar_command_t; #define STREAM_NONE ((uint16_t)0xFFFF) #define HEADER_SIZE 10 static int command_send(shout_t *self, shout_roar_command_t command, uint16_t stream, const void *data, size_t datalen) { uint8_t header[HEADER_SIZE]; if (!self) return SHOUTERR_INSANE; if (datalen > 65535) return SHOUTERR_INSANE; if (datalen && !data) return SHOUTERR_INSANE; /* version. * While version 2 is already on it's way we still go for version 0 * as it will work well for us and is defined as part of the core * every RoarAudio server MUST implement. */ header[0] = 0; /* command ID. */ header[1] = command; /* stream ID. First upper then lower byte. */ header[2] = (stream & 0xFF00) >> 8; header[3] = (stream & 0x00FF); /* now 4 bytes of stream position. * This implementation doesn't need this so we * set it to all zeros. */ header[4] = 0; header[5] = 0; header[6] = 0; header[7] = 0; /* Now body ("data") size. First upper then lower byte. */ header[8] = (datalen & 0xFF00) >> 8; header[9] = (datalen & 0x00FF); shout_queue_data(&self->wqueue, header, HEADER_SIZE); if (datalen) shout_queue_data(&self->wqueue, data, datalen); return SHOUTERR_SUCCESS; } static int shout_create_roaraudio_request_ident(shout_t *self) { int ret; size_t datalen; uint8_t *data; const char *agent; uint32_t pid = getpid(); /* We implement version 1 IDENTIFY header. * It has the following structure: * byte 0: version (1). * byte 1-4: PID in big endian. * byte 5-end: client name. */ agent = shout_get_agent(self); if (!agent) return SHOUTERR_INSANE; datalen = 5 + strlen(agent); data = malloc(datalen); if (!data) return SHOUTERR_MALLOC; /* version number (1). */ data[0] = 1; /* PID */ data[1] = (pid & 0xFF000000UL) >> 24; data[2] = (pid & 0x00FF0000UL) >> 16; data[3] = (pid & 0x0000FF00UL) >> 8; data[4] = (pid & 0x000000FFUL) >> 0; /* agent name */ memcpy(data+5, agent, datalen-5); ret = command_send(self, CMD_IDENTIFY, STREAM_NONE, data, datalen); free(data); return ret; } static int shout_create_roaraudio_request_auth(shout_t *self) { /* Now we send an AUTH command to the server. * We currently only implement the NONE type. * NONE type is assumed by the server if * we send an empty body. */ return command_send(self, CMD_AUTH, STREAM_NONE, NULL, 0); } static int shout_create_roaraudio_request_new_stream(shout_t *self) { uint32_t data[6]; /* We implement 24 byte NEW_STREAM structure (version 0). * It has the following structure: * byte 0- 3: stream direction [0]. * byte 4- 7: Rel Pos ID (here: -1=NONE) * byte 8-11: Sample Rate[1]. * byte 12-15: Bits per Sample[1]. * byte 16-19: Number of Channels[1]. * byte 20-23: Codec ID[2]. * * The following asumptions are based on us only supporting * Ogg-based for now. * [0] = We currently only suport playback of waveform signals (1). * See https://bts.keep-cool.org/wiki/Specs/DirValues * [1] = Server should detect automagically. defaulting to: 44100/16/2. * [2] = Ogg/Vorbis = 0x0010, Ogg/Speex = 0x0012, Ogg/FLAC = 0x0014, * Ogg/CELT = 0x0016, Ogg/GENERAL (unknown logical streams) = 0x0015. * See https://bts.keep-cool.org/wiki/Specs/CodecsValues */ data[0] = htonl(1); data[1] = htonl((uint32_t)-1); data[2] = htonl(44100); data[3] = htonl(32); data[4] = htonl(2); data[5] = htonl(0x0010); /* we assume Ogg/Vorbis for now. */ return command_send(self, CMD_NEW_STREAM, STREAM_NONE, data, 24); } static int shout_create_roaraudio_request_exec(shout_t *self) { /* Last an EXEC_STREAM command should be sent to open * an IO channel for the new stream. * If successful the control socket will be used for data * after that. This very much like with SOURCE requests. * so no hard deal to intigrate. */ return command_send(self, CMD_EXEC_STREAM, self->protocol_extra, NULL, 0); } int shout_create_roaraudio_request(shout_t *self) { switch ((shout_roar_protocol_state_t)self->protocol_state) { case STATE_IDENT: return shout_create_roaraudio_request_ident(self); break; case STATE_AUTH: return shout_create_roaraudio_request_auth(self); break; case STATE_NEW_STREAM: return shout_create_roaraudio_request_new_stream(self); break; case STATE_EXEC: return shout_create_roaraudio_request_exec(self); break; } return SHOUTERR_INSANE; } int shout_get_roaraudio_response(shout_t *self) { shout_buf_t *queue; size_t total_len = 0; uint8_t header[HEADER_SIZE]; for (queue = self->rqueue.head; queue; queue = queue->next) { if (total_len < 10) memcpy(header+total_len, queue->data, queue->len > (HEADER_SIZE - total_len) ? (HEADER_SIZE - total_len) : queue->len); total_len += queue->len; } /* the header alone has 10 bytes. */ if (total_len < HEADER_SIZE) return SHOUTERR_BUSY; /* ok. we got a header. * Now find the body length ("data length") bytes * and see if they are both zero. * If not the server sent us extra infos we currently * not support. */ if (header[8] || header[9]) return SHOUTERR_UNSUPPORTED; /* Hey, we got a response. */ return SHOUTERR_SUCCESS; } int shout_parse_roaraudio_response(shout_t *self) { char *data = NULL; uint8_t header[HEADER_SIZE]; /* ok, this is the most hacky function in here as we do not * use a well designed and universal parser for the responses. * Yet there is little need for it. * We just need to check if we got an CMD_OK and * pull out the stream ID in case of STATE_NEW_STREAM. * "data length" is already checked by shout_get_roaraudio_response(). */ if (shout_queue_collect(self->rqueue.head, &data) != HEADER_SIZE) { free(data); return SHOUTERR_INSANE; } shout_queue_free(&self->rqueue); memcpy(header, data, HEADER_SIZE); free(data); /* check version */ if (header[0] != 0) return SHOUTERR_UNSUPPORTED; /* have we got a positive response? */ if (header[1] != CMD_OK) return SHOUTERR_NOLOGIN; switch ((shout_roar_protocol_state_t)self->protocol_state) { case STATE_IDENT: self->protocol_state = STATE_AUTH; break; case STATE_AUTH: self->protocol_state = STATE_NEW_STREAM; break; case STATE_NEW_STREAM: self->protocol_extra = (((unsigned int)header[2]) << 8) | (unsigned int)header[3]; self->protocol_state = STATE_EXEC; break; case STATE_EXEC: /* ok. everything worked. Continue normally! */ return SHOUTERR_SUCCESS; break; default: return SHOUTERR_INSANE; break; } self->state = SHOUT_STATE_REQ_CREATION; return SHOUTERR_RETRY; } libshout-idjc-2.4.1/src/proto_icy.c 0000644 0001750 0001750 00000004467 12631271614 014157 0000000 0000000 /* -*- c-basic-offset: 8; -*- */ /* proto_icy.c: Implementation of protocol ICY. * * Copyright (C) 2002-2004 the Icecast team , * Copyright (C) 2012-2015 Philipp "ph3-der-loewe" Schafft * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id$ */ #ifdef HAVE_CONFIG_H #include #endif #include #include "shout_private.h" int shout_create_icy_request(shout_t *self) { const char *bitrate; const char *val; int ret; bitrate = shout_get_audio_info(self, SHOUT_AI_BITRATE); if (!bitrate) bitrate = "0"; ret = SHOUTERR_MALLOC; do { if (shout_queue_printf(self, "%s\n", self->password)) break; if (shout_queue_printf(self, "content-type:%s\n", shout_get_mimetype(self))) break; if (shout_queue_printf(self, "icy-name:%s\n", shout_get_meta(self, "name"))) break; val = shout_get_meta(self, "url"); if (shout_queue_printf(self, "icy-url:%s\n", val ? val : "http://www.icecast.org/")) break; val = shout_get_meta(self, "irc"); if (shout_queue_printf(self, "icy-irc:%s\n", val ? val : "")) break; val = shout_get_meta(self, "aim"); if (shout_queue_printf(self, "icy-aim:%s\n", val ? val : "")) break; val = shout_get_meta(self, "icq"); if (shout_queue_printf(self, "icy-icq:%s\n", val ? val : "")) break; if (shout_queue_printf(self, "icy-pub:%i\n", self->public)) break; val = shout_get_meta(self, "genre"); if (shout_queue_printf(self, "icy-genre:%s\n", val ? val : "icecast")) break; if (shout_queue_printf(self, "icy-br:%s\n\n", bitrate)) break; ret = SHOUTERR_SUCCESS; } while (0); return ret; } libshout-idjc-2.4.1/src/proto_xaudiocast.c 0000644 0001750 0001750 00000005240 12631271614 015525 0000000 0000000 /* -*- c-basic-offset: 8; -*- */ /* proto_xaudiocast.c: Implementation of protocol xaudiocast. * * Copyright (C) 2002-2004 the Icecast team , * Copyright (C) 2012-2015 Philipp "ph3-der-loewe" Schafft * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id$ */ #ifdef HAVE_CONFIG_H #include #endif #include