Changeset 5740:b3aff85876f1 in roaraudio for plugins/roard/protocol-gopher.c
- Timestamp:
- 11/09/12 02:51:16 (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/roard/protocol-gopher.c
r5739 r5740 24 24 */ 25 25 26 #include "roard.h" 26 #include <roard/include/roard.h> 27 28 #ifndef DISTRIBUTION_VERSION_STRING 29 #define DISTRIBUTION_VERSION_STRING "" 30 #endif 31 #ifndef PACKAGE_VERSION 32 #define PACKAGE_VERSION "" 33 #endif 34 #ifndef DEVICE_VENDOR_STRING 35 #define DEVICE_VENDOR_STRING "" 36 #endif 27 37 28 38 #ifndef ROAR_WITHOUT_DCOMP_EMUL_GOPHER … … 93 103 94 104 static int send_menu (int client, struct roar_gopher_menu * menu, struct roar_vio_calls * vio); 95 static int send_text ( int client, const char * text, struct roar_vio_calls * vio);105 static int send_text (const char * text, struct roar_buffer ** obuffer); 96 106 97 107 … … 100 110 const size_t len = 1024; 101 111 const char * server_version = NULL; 112 113 (void)client, (void)vio, (void)selector, (void)text, (void)sitem; 102 114 103 115 if ( DISTRIBUTION_VERSION_STRING[0] == 0 ) { … … 138 150 size_t len; 139 151 152 (void)client, (void)vio; 153 140 154 toks = roar_mm_strseltok(sitem->selector, selector, &tok, 1); 141 155 … … 169 183 size_t i; 170 184 int ret; 185 186 (void)selector, (void)text, (void)sitem; 171 187 172 188 memset(items, 0, sizeof(items)); … … 224 240 int ret; 225 241 242 (void)selector, (void)text, (void)sitem; 243 226 244 memset(items, 0, sizeof(items)); 227 245 … … 281 299 char tmp[80]; 282 300 301 (void)text; 302 283 303 memset(items, 0, sizeof(items)); 284 304 … … 356 376 int id; 357 377 378 (void)text; 379 358 380 memset(items, 0, sizeof(items)); 359 381 … … 391 413 s->info.rate, s->info.bits, s->info.channels, roar_codec2str(s->info.codec)); 392 414 393 if ( ss->codec_orgi != -1&& ss->codec_orgi != s->info.codec ) {415 if ( ss->codec_orgi != ROAR_AUDIO_INFO_INVALID && ss->codec_orgi != s->info.codec ) { 394 416 item = &(items[menu.items_len++]); 395 417 item->type = _INFO; … … 431 453 size_t i; 432 454 455 (void)selector, (void)text, (void)sitem; 456 433 457 memset(items, 0, sizeof(items)); 434 458 … … 472 496 int stream = -1; 473 497 498 (void)vio, (void)text; 499 474 500 toks = roar_mm_strseltok(sitem->selector, selector, tok, 5); 475 501 … … 496 522 info.codec = roar_str2codec(tok[4]); 497 523 498 if ( info.codec == -1)524 if ( info.codec == ROAR_AUDIO_INFO_INVALID ) 499 525 return -1; 500 526 … … 593 619 break; 594 620 default: 595 host = item->host == NULL ? sockaddr.addr : item->host;596 port = item->port == 0 ? sockaddr.port : item->port;621 host = item->host == NULL ? sockaddr.addr : item->host; 622 port = item->port == 0 ? (unsigned int)sockaddr.port : item->port; 597 623 snprintf(data, len-1, "%c%s\t%s\t%s\t%u\r\n", item->type, item->name, item->selector, host, port); 598 624 break; … … 615 641 } 616 642 617 static int send_text ( int client, const char * text, struct roar_vio_calls * vio) {643 static int send_text (const char * text, struct roar_buffer ** obuffer) { 618 644 struct roar_buffer * buf; 619 645 void * data; … … 626 652 //memcpy(data+len, "\r\n.\r\n\0", 6); 627 653 memcpy(data+len, "\0", 1); 628 clients_add_output(client, &buf); 654 if ( roar_buffer_moveintoqueue(obuffer, &buf) == -1 ) 655 return -1; 629 656 630 657 return 0; … … 642 669 char * text; 643 670 671 (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 672 644 673 ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio); 645 674 … … 718 747 719 748 if ( funcret == 0 && text != NULL ) 720 funcret = send_text( client, text, vio);749 funcret = send_text(text, obuffer); 721 750 722 751 if ( text != NULL ) … … 728 757 break; 729 758 case _FILE: 730 funcret = send_text(c lient, c->text, vio);759 funcret = send_text(c->text, obuffer); 731 760 break; 732 761 default: … … 749 778 750 779 static int emul_gopher_flushed_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) { 780 781 (void)client, (void)vio, (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 782 751 783 ROAR_DBG("emul_gopher_flushed_client(client=%i, vio=%p) = ?", client, vio); 752 784 … … 754 786 } 755 787 756 st ruct roar_dl_proto __proto_common_gopher = {788 static struct roar_dl_proto __proto_common_gopher = { 757 789 .proto = ROAR_PROTO_GOPHER, 758 790 .description = "The Internet Gopher Protocol", … … 762 794 }; 763 795 796 static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) { 797 (void)para, (void)lib; 798 ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, __proto_common_gopher, ROAR_DL_PROTO_VERSION); 799 return 0; 800 } 801 802 ROAR_DL_PLUGIN_START(protocol_gopher) { 803 ROARD_DL_CHECK_VERSIONS(); 804 805 ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-gopher", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO); 806 ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING); 807 ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0); 808 ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org"); 809 ROAR_DL_PLUGIN_META_DESC("Implementation of the Internet Gopher protocol"); 810 811 ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto); 812 } ROAR_DL_PLUGIN_END 813 764 814 #endif 765 815
Note: See TracChangeset
for help on using the changeset viewer.