Example #1
0
int		cmd_get(t_info *info, t_cmd *cmd)
{
  t_rep		rep;
  int		fd;

  if (!get_pasv(info) || (fd = open_file(cmd->arg)) == -1)
    return (0);
  if (!send_cmd(info, "TYPE", "I") || !get_answer(info, &rep))
    return (0);
  send_cmd(info, "RETR", cmd->arg);
  if (get_answer(info, &rep) && rep.code == 150 &&
      connect_dtp(info->dtp) && read_data(info, info->dtp->socket, fd))
    {
      if (get_answer(info, &rep) && IS_200(rep.code))
	{
	  close_dtp(info);
	  return (1);
	}
      close_dtp(info);
      return (0);
    }
  close(fd);
  close_dtp(info);
  return (1);
}
Example #2
0
int main ()
{
  freopen ("rle.in", "rt", stdin);
  freopen ("rle.out", "wt", stdout);

  scanf ("%s", rle);
  un_rle ();
#ifdef _DBG_
  for (int i = 0; i < num; i++)
    printf ("%c %I64d-%I64d (%d)\n", str[i].c, str[i].a, str[i].b, str[i].len);
#endif
  
  run_kmp ();

#ifdef _DBG_
  printf ("!\n");
  for (int i = 0; i < nkmp; i++)
    printf ("%I64d %d %I64d-%I64d (%d)\n", kmp[i].first, kmp[i].delta, kmp[i].a, kmp[i].b, kmp[i].len);
#endif
  int n;
  scanf ("%d", &n);
  for (int i = 0; i < n; i++)
  {
    __int64 a;
    scanf ("%I64d", &a);
    printf ("%I64d\n", get_answer (a - 1));
//    printf ("%d\n", bin_search (a - 1));
  }

  return 0;
}
Example #3
0
int cmd_systime_get(HttpdConnData *conn) {
	uint8_t i;
	for (i = 0; i < 4; i++) {
		os_printf("\r\nsystime_get\r\n");
		bool res = get_answer(200);
		if (res == true) {
			uint8_t seconds = integer_from_string(ans_buf, 0);
			uint8_t minutes = integer_from_string(ans_buf, 1);
			uint8_t hours = integer_from_string(ans_buf, 2);
			uint8_t date = integer_from_string(ans_buf, 3);
			uint8_t month = integer_from_string(ans_buf, 4);
			uint8_t year = integer_from_string(ans_buf, 5);
			uint8_t dow = integer_from_string(ans_buf, 6);

			char dow_readable[30];
			if (dow == 255) continue;
			else if (dow == 1) os_strcpy(dow_readable, "Montag");
			else if (dow == 2) os_strcpy(dow_readable, "Dienstag");
			else if (dow == 3) os_strcpy(dow_readable, "Mittwoch");
			else if (dow == 4) os_strcpy(dow_readable, "Donnerstag");
			else if (dow == 5) os_strcpy(dow_readable, "Freitag");
			else if (dow == 6) os_strcpy(dow_readable, "Samstag");
			else if (dow == 7) os_strcpy(dow_readable, "Sonntag");
			else if (dow == 0) os_strcpy(dow_readable, "Ungültige Systemzeit");

			char resbuf[80];
			os_sprintf(resbuf, "%s, %d.%d.%d %d:%d:%d Uhr", dow_readable, date, month, year, hours, minutes, seconds);
			httpdSend(conn, resbuf, -1);
			return HTTPD_CGI_DONE;
		}
	}

	httpdSend(conn, "Keine Antwort vom AVR-Controller", -1);
	return HTTPD_CGI_DONE;
}
Example #4
0
int cmd_opentime_set(HttpdConnData *conn) {
	// Parse command from GET parameters
	char hours_str[5];
	char minutes_str[5];

	httpdFindArg(conn->getArgs, "hours", hours_str, sizeof(hours_str));
	httpdFindArg(conn->getArgs, "minutes", minutes_str, sizeof(minutes_str));

	char command[30];
	os_sprintf(command, "\r\nopentime_set %s %s\r\n", hours_str, minutes_str);

	// Send command / wait for answer
	uint8_t i;
	for (i = 0; i < 4; i++) {
		os_printf(command);
		bool res = get_answer(200);
		if (res == true && os_strcmp("ots_ok", ans_buf) == 0) {
			httpdSend(conn, "ok", -1);
			return HTTPD_CGI_DONE;
		}
	}

	httpdSend(conn, "Keine Antwort vom AVR-Controller", -1);
	return HTTPD_CGI_DONE;
}
Example #5
0
static int	login_user(t_info *info, t_rep *rep)
{
  char		buffer[512];
  t_rep		rep_login;

  if (!(IS_200(rep->code)) || write(1, "User: "******"USER", buffer))
	return (0);
      if (!get_answer(info, &rep_login))
	return (0);
      if (IS_200(rep_login.code))
	return (1);
      if (IS_300(rep_login.code))
	return (login_pass(info));
      return (0);
    }
  else
    return (0);
  return (1);
}
Example #6
0
int
main(int argc, char *argv[])
{
	struct reader_t rout;
	struct reader_t rsol;
	const char *pts;

	if (argc != 4)
		return 1;

	reader_init(&rsol, argv[2]);
	reader_init(&rout, argv[3]);

	if (rsol.f == NULL)
		return 1;

	if (rout.f == NULL) {
		reader_free(&rsol);
		printf("%s\n", pts_zero);
		return 0;
	}

	pts = get_answer(&rsol, &rout);
	printf("%s\n", pts);

	reader_free(&rsol);
	reader_free(&rout);
	return 0;
}
Example #7
0
int main(int argc, const char *argv[])
{
    float money = 0;
    printf("Please input the money: ");
    scanf("%f", &money);
    get_answer(money);
    return 0;
}
TEST(dlfcn, dlsym_df_1_global) {
  void* handle = dlopen("libtest_dlsym_df_1_global.so", RTLD_NOW);
  ASSERT_TRUE(handle != nullptr) << dlerror();
  int (*get_answer)();
  get_answer = reinterpret_cast<int (*)()>(dlsym(handle, "dl_df_1_global_get_answer"));
  ASSERT_TRUE(get_answer != nullptr) << dlerror();
  ASSERT_EQ(42, get_answer());
  ASSERT_EQ(0, dlclose(handle));
}
Example #9
0
int		cmd_cd(t_info *info, t_cmd *cmd)
{
  t_rep		rep;

  if (!send_cmd(info, "CWD", cmd->arg) || !get_answer(info, &rep))
    return (0);
  if (IS_200(rep.code))
    return (1);
  return (0);
}
Example #10
0
static int	open_session(t_info *info)
{
  t_rep		rep;

  if (!get_answer(info, &rep))
    {
      info->keep_connected = 0;
      return (0);
    }
  return (login_user(info, &rep));
}
Example #11
0
int main(int argc, char **argv)
{
	char* question;
	char* answer;
	while(1)
	{
		question = get_question();
		answer = get_answer();

		printf("%s\n", answer);
	}
	return 0;	
}
TEST(dlfcn, dlsym_df_1_global) {
#if !defined(__arm__) && !defined(__aarch64__)
  void* handle = dlopen("libtest_dlsym_df_1_global.so", RTLD_NOW);
  ASSERT_TRUE(handle != nullptr) << dlerror();
  int (*get_answer)();
  get_answer = reinterpret_cast<int (*)()>(dlsym(handle, "dl_df_1_global_get_answer"));
  ASSERT_TRUE(get_answer != nullptr) << dlerror();
  ASSERT_EQ(42, get_answer());
  ASSERT_EQ(0, dlclose(handle));
#else
  GTEST_LOG_(INFO) << "This test does nothing on arm/arm64 (to be reenabled once b/18137520 or b/18130452 are fixed).\n";
#endif
}
Example #13
0
int		cmd_ls(t_info *info, t_cmd *cmd)
{
  t_rep		rep;

  (void)cmd;
  if (!get_pasv(info))
    return (0);
  send_cmd(info, "LIST", cmd->arg);
  if (get_answer(info, &rep) && rep.code == 150 &&
      connect_dtp(info->dtp) && read_data(info, info->dtp->socket, 1))
    {
      if (get_answer(info, &rep) && IS_200(rep.code))
	{
	  close_dtp(info);
	  return (1);
	}
      close_dtp(info);
      return (0);
    }
  close_dtp(info);
  return (1);
}
void input_query() {	
	int i, j, result;
	int v, k;
	char c[2];

	for (int l = 1; l <= q; l++) {
		scanf("%s", &c);
		if (c[0] == 'M') {
			scanf("%d%d", &i, &v);
			//fflush(stdin);
			i--;
			update(i, v);
		}
		if (c[0] == 'C') {
			scanf("%d%d%d", &i, &j, &k);
			//fflush(stdin);
			i--; 
			j--;
			result = get_answer(j, k) - get_answer(i - 1, k);
			printf("%d\n", result);
		}
	}
}
Example #15
0
/*----------------------------------------------------------------------------
 *  get_value (char * cmd)         - send command, get value
 *----------------------------------------------------------------------------
 */
static char *get_value(const char *cmd)
{
    char *answer;

    send_command(fd, cmd);

    answer = get_answer(fd);

    if (answer) {
	return (answer);
    }

    return ("");
}				/* get_value (char * cmd, int arg) */
Example #16
0
int cmd_slider_down(HttpdConnData *conn) {
	uint8_t i;
	for (i = 0; i < 4; i++) {
		os_printf("\r\nslider_down\r\n");
		bool res = get_answer(200);
		if (res == true && os_strcmp("sld_ok", ans_buf) == 0) {
			httpdSend(conn, "ok", -1);
			return HTTPD_CGI_DONE;
		}
	}

	httpdSend(conn, "Keine Antwort vom AVR-Controller", -1);
	return HTTPD_CGI_DONE;
}
Example #17
0
void init()
{
    if (fd != 0)
	return;

    fd = service_connect(ihost, iport);

    if (fd < 0) {
	err++;
    } else if ((ipass != NULL) && (*ipass != '\0')) {	/* Passwort senden */
	char buf[40];
	qprintf(buf, sizeof(buf), "pass %s", ipass);
	send_command(fd, buf);
	get_answer(fd);
    }
}
Example #18
0
/**
 * HTTP commands
 * They forward the corresponding command to the AVR controller and decode the
 * answer. The may then forward that answer to the HTTP client in a human-readable
 * format.
 */
int cmd_slider_up(HttpdConnData *conn) {
	uint8_t i;
	for (i = 0; i < 4; i++) {
		os_printf("\r\nslider_up\r\n");
		bool res = get_answer(200);
		if (res == true && os_strcmp("slu_ok", ans_buf) == 0) {
			os_printf("Leaving with success state\r\n");
			httpdSend(conn, "ok", -1);
			return HTTPD_CGI_DONE;
		}
	}

	os_printf("Leaving with error state, buffer is %s\r\n", ans_buf);
	httpdSend(conn, "Keine Antwort vom AVR-Controller", -1);
	return HTTPD_CGI_DONE;
}
Example #19
0
int		get_pasv(t_info *info)
{
  t_rep		rep;
  char		*ip_str;
  char		ip[16];
  unsigned int	port;

  memset(ip, 0, sizeof(ip));
  if (!send_cmd(info, "PASV", NULL) || !get_answer(info, &rep))
    return (0);
  if (!(ip_str = get_ip_str(rep.msg)))
    return (0);
  get_ip_value(ip_str, ip);
  port = get_port_value(ip_str);
  return (create_dtp(info, ip, port));
}
Example #20
0
/* send a read command and try get the answer, if something fails, it retries (5 times max)
   if it is on the 4th or 5th retry, it will flush the serial before sending commands
   it returns the length of the received answer or -1 in case of failure */
int command_read_sequence(unsigned char command, unsigned char *data) {
	int bytes_read = 0;
	int retry = 0;

	while ((bytes_read < 1) && (retry < 5)) {
		send_read_command(command);
		bytes_read = get_answer(data);
		if (retry > 2) ser_flush_in(upsfd, "", 0);
		retry += 1;
	}
	if ((data[0] != command) || (retry == 5)) {
		ser_comm_fail("Error executing command %d\n", command);
		dstate_datastale();
		return -1;
	}
	ser_comm_good();
	return bytes_read;
}
Example #21
0
/* send a write command and try get the answer, if something fails, it retries (5 times max)
   if it is on the 4th or 5th retry, it will flush the serial before sending commands
   it returns the length of the received answer or -1 in case of failure */
int command_write_sequence(unsigned char *command, int command_length, unsigned char *answer) {
	int bytes_read = 0;
	int retry = 0;
	
	while ((bytes_read < 1) && (retry < 5)) {
		send_write_command(command, command_length);
		bytes_read = get_answer(answer);
		if (retry > 2) ser_flush_in(upsfd, "", 0);
		retry += 1;
	}
	if ((answer[0] != command[0]) || (retry == 5)) {
		ser_comm_fail("Error executing command N.%d\n", command[0]);
		dstate_datastale();
		return -1;
	}
	ser_comm_good();
	return bytes_read;
}
Example #22
0
void pollhandle(int fd)
{
	char qbuf[128];
	unsigned int syncnum, answer;
	int n;
	n = read(fd, qbuf, 128);
	if (n < 0)
		perx("read from query");
	if (sscanf(qbuf, "Q syncnum=%u", &syncnum) != 1) {
		fprintf(stderr, "get error query:%s\n", qbuf);	
		exit(EXIT_FAILURE);	
	}
	printf("Do you allow this operation?('Y'es/Others)\n");		
	answer = get_answer();
	n = snprintf(qbuf, 128, "A syncnum=%u answer=%u\n", syncnum, answer);
	if (write(fd, qbuf, n) != n)
		perx("write query");
}
Example #23
0
int cmd_battery_get(HttpdConnData *conn) {
	uint8_t i;
	for (i = 0; i < 4; i++) {
		os_printf("\r\nbattery_get\r\n");
		bool res = get_answer(200);
		if (res == true) {
			uint8_t voltage = integer_from_string(ans_buf, 0);
			uint8_t percent = integer_from_string(ans_buf, 1);

			char resbuf[50];
			os_sprintf(resbuf, "Batteriespannung ist %u.%uV, geschätzt %u%", (voltage - voltage % 10) / 10, voltage % 10, percent);
			httpdSend(conn, resbuf, -1);
			return HTTPD_CGI_DONE;
		}
	}

	httpdSend(conn, "Keine Antwort vom AVR-Controller", -1);
	return HTTPD_CGI_DONE;
}
Example #24
0
static int command_sequence(unsigned char *command, int command_length, unsigned char *answer)
{
	int	bytes_read, retry = 0;

	while (retry++ < PW_MAX_TRY) {

		if (retry == PW_MAX_TRY) {
			ser_flush_in(upsfd, "", 0);
		}

		send_write_command(command, command_length);

		bytes_read = get_answer(answer, *command);

		if (bytes_read > 0) {
			return bytes_read;
		}
	}

	return -1;
}
Example #25
0
File: libpola.c Project: Kowai/Pola
int iopen (const char* pathname, int flags,
                         int (*Normal_Open)(const char *name, int flags))
{
	mode *m=NULL;m->ask=0;

	//will compare the flags & FLAGS and fill the mode allowance struct
	get_droit(m,flags,pathname );

    // if we have asked a question
    if (m->ask)
    {
    	get_answer(m);
    	//if the acces is denied
        if(isdenied(m,pathname)) {
        	return -1;// it will exit with an error
        }
    }

	// everything passed, now call the original open
    return Normal_Open(pathname, flags);
}
Example #26
0
int cmd_opentime_get(HttpdConnData *conn) {
	uint8_t i;
	for (i = 0; i < 4; i++) {
		os_printf("\r\nopentime_get\r\n");
		bool res = get_answer(200);
		if (res == true) {
			uint8_t hours = integer_from_string(ans_buf, 0);
			uint8_t minutes = integer_from_string(ans_buf, 1);

			char resbuf[50];
			if (hours == 25)
				os_sprintf(resbuf, "Klappe wird nicht automatisch geöffnet");
			else
				os_sprintf(resbuf, "Aufmachzeit ist %d:%d Uhr", hours, minutes);
			httpdSend(conn, resbuf, -1);
			return HTTPD_CGI_DONE;
		}
	}

	httpdSend(conn, "Keine Antwort vom AVR-Controller", -1);
	return HTTPD_CGI_DONE;
}
Example #27
0
static int	login_pass(t_info *info)
{
  char		buffer[512];
  t_rep		rep;

  memset(buffer, 0, sizeof(buffer));
  if (write(1, "Pass: "******"PASS", buffer))
	return (0);
      if (!get_answer(info, &rep))
	return (0);
      if (!(IS_200(rep.code)))
	return (0);
      return (1);
    }
  else
    return (0);
  return (1);
}
static void write_conv(PurpleConversation *conv, const char *who, const char *alias,
        const char *message, PurpleMessageFlags flags, time_t mtime) {
    if (!(flags & PURPLE_MESSAGE_RECV))
        return;

    const char *name;
    if (alias && *alias)
        name = alias;
    else if (who && *who)
        name = who;
    else
        name = NULL;

    printf("(%s) %s %s: %s\n", purple_conversation_get_name(conv),
            purple_utf8_strftime("(%H:%M:%S)", localtime(&mtime)),
            name, message);

    time_t rawtime;

    char send_message[5120];
    get_answer(message, &send_message[0]);
    //printf("%s", send_message);
    purple_conv_im_send(PURPLE_CONV_IM(conv), send_message);
}
Example #29
0
void do_nerd_sm (bool pressed, uint32_t count) {
	char result[2];
	result[1]=0;


	switch (sm.state) {
		case start:
		case press_any_key:
			type("press anykey to continue!");
			sm.state = question_;
			break;
		case question_:
			if (pressed) {
				command("\nclear\n");
				random_question(&sm, count);
				sm.state=question_print;
			}	
			break;
		case question_print:
			if (!pressed) {
				//type ("question\n");
				type_question(sm.question);
				sm.state=press_1_0;
				sm.last_time = count;
			};
			break;
		case press_1_0:
			CHK_TIMEOUT(500)
			if (pressed) { 
				sm.state = press_1_1; 
				sm.last_time = count;	
			}
			break;
		case press_1_1:
			CHK_TIMEOUT(CLICK_TIME)
			if (!pressed) {
				sm.state = press_2_0;
				sm.last_time = count;
			}
			break;
		case press_2_0:
			CHK_ANSWR(1);
			if (pressed) {
				sm.state = press_2_1;
				sm.last_time = count;
			}
			break;
		case press_2_1:
			CHK_TIMEOUT(CLICK_TIME)
			if (!pressed) {
				sm.state = press_3_0;
				sm.last_time = count;
			}
			break;
		case press_3_0:
			CHK_ANSWR(2);
			if (pressed) {
				sm.state = press_3_1;
				sm.last_time = count;
			}
			break;
		case press_3_1:
			CHK_TIMEOUT(CLICK_TIME)
			if (!pressed) {
				sm.state = press_4_0;
				sm.last_time = count;
			}
			break;
		case press_4_0:
			CHK_ANSWR(3);
			if (pressed) {
				sm.state = press_4_1;
				sm.last_time = count;
			}
			break;
		case press_4_1:
			CHK_TIMEOUT(CLICK_TIME)
				if (!pressed) {
					sm.answer = 4;
					sm.state  = check;
				}
			break;
		case check:
			//	result[0]= sm.answer+0x30;
			//	type(result);
			if (sm.answer == get_answer(sm.question)) {
				command("cowsay hurrah!\n");
				delay(100000);
			} else {
				type("Wrong!\n");
				delay(5000000);
				command("cowsay -f hellokitty rm -rf /\n");
				delay(100000);
			}
			sm.state = press_any_key;
			break;      
		case timeout:
			command("cowsay -f turtle faster\n");
				delay(100000);
			if (!pressed) {
				sm.state = press_any_key;
			}
			break;
		default:
			sm.state = start;
	}
}
Example #30
0
int asf_mmst_streaming_start(stream_t *stream)
{
    char                 str[1024];
    char                 data[BUF_SIZE];
    uint8_t              asf_header[HDR_BUF_SIZE];
    int                  asf_header_len;
    int                  i, packet_length;
    char                *path, *unescpath;
    URL_t *url1 = stream->streaming_ctrl->url;
    int s = stream->fd;

    if( s>0 ) {
        closesocket( stream->fd );
        stream->fd = -1;
    }

    /* parse url */
    path = strchr(url1->file,'/') + 1;

    /* mmst filename are not url_escaped by MS MediaPlayer and are expected as
     * "plain text" by the server, so need to decode it here
     */
    unescpath=malloc(strlen(path)+1);
    if (!unescpath) {
        mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
        return -1;
    }
    url_unescape_string(unescpath,path);
    path=unescpath;


    if( url1->port==0 ) {
        url1->port=1755;
    }
    s = connect2Server( url1->hostname, url1->port, 1);
    if( s<0 ) {
        free(path);
        return s;
    }
    mp_tmsg(MSGT_NETWORK,MSGL_INFO,"Connected\n");

    seq_num=0;

    /*
    * Send the initial connect info including player version no. Client GUID (random) and the host address being connected to.
    * This command is sent at the very start of protocol initiation. It sends local information to the serve
    * cmd 1 0x01
    * */

    /* prepare for the url encoding conversion */
#ifdef CONFIG_ICONV
    url_conv = iconv_open("UTF-16LE", "UTF-8");
#endif

    snprintf (str, 1023, "\034\003NSPlayer/7.0.0.1956; {33715801-BAB3-9D85-24E9-03B90328270A}; Host: %s", url1->hostname);
    string_utf16 (data, str, strlen(str));
// send_command(s, commandno ....)
    send_command (s, 1, 0, 0x0004000b, strlen(str)*2+2, data);

    recv (s, data, BUF_SIZE, 0) ;

    /*This sends details of the local machine IP address to a Funnel system at the server.
    * Also, the TCP or UDP transport selection is sent.
    *
    * here 192.168.0.1 is local ip address TCP/UDP states the tronsport we r using
    * and 1037 is the  local TCP or UDP socket number
    * cmd 2 0x02
    *  */

    string_utf16 (&data[8], "\002\000\\\\192.168.0.1\\TCP\\1037", 24);
    memset (data, 0, 8);
    send_command (s, 2, 0, 0, 24*2+10, data);

    recv (s, data, BUF_SIZE, 0) ;

    /* This command sends file path (at server) and file name request to the server.
    * 0x5 */

    string_utf16 (&data[8], path, strlen(path));
    memset (data, 0, 8);
    send_command (s, 5, 0, 0, strlen(path)*2+10, data);
    free(path);

    get_answer (s);

    /* The ASF header chunk request. Includes ?session' variable for pre header value.
    * After this command is sent,
    * the server replies with 0x11 command and then the header chunk with header data follows.
    * 0x15 */

    memset (data, 0, 40);
    data[32] = 2;

    send_command (s, 0x15, 1, 0, 40, data);

    num_stream_ids = 0;
    /* get_headers(s, asf_header);  */

    asf_header_len = get_header (s, asf_header, stream->streaming_ctrl);
//  mp_msg(MSGT_NETWORK,MSGL_INFO,"---------------------------------- asf_header %d\n",asf_header);
    if (asf_header_len==0) { //error reading header
        closesocket(s);
        return -1;
    }
    packet_length = interp_header (asf_header, asf_header_len);


    /*
    * This command is the media stream MBR selector. Switches are always 6 bytes in length.
    * After all switch elements, data ends with bytes [00 00] 00 20 ac 40 [02].
    * Where:
    * [00 00] shows 0x61 0x00 (on the first 33 sent) or 0xff 0xff for ASF files, and with no ending data for WMV files.
    * It is not yet understood what all this means.
    * And the last [02] byte is probably the header ?session' value.
    *
    *  0x33 */

    memset (data, 0, 40);

    int audio_id = stream->opts->audio_id;
    if (audio_id > 0) {
        data[2] = 0xFF;
        data[3] = 0xFF;
        data[4] = audio_id;
        send_command(s, 0x33, num_stream_ids, 0xFFFF | audio_id << 16, 8, data);
    } else {
        for (i=1; i<num_stream_ids; i++) {
            data [ (i-1) * 6 + 2 ] = 0xFF;
            data [ (i-1) * 6 + 3 ] = 0xFF;
            data [ (i-1) * 6 + 4 ] = stream_ids[i];
            data [ (i-1) * 6 + 5 ] = 0x00;
        }

        send_command (s, 0x33, num_stream_ids, 0xFFFF | stream_ids[0] << 16, (num_stream_ids-1)*6+2 , data);
    }

    get_answer (s);

    /* Start sending file from packet xx.
    * This command is also used for resume downloads or requesting a lost packet.
    * Also used for seeking by sending a play point value which seeks to the media time point.
    * Includes ?session' value in pre header and the maximum media stream time.
    * 0x07 */

    memset (data, 0, 40);

    for (i=8; i<16; i++)
        data[i] = 0xFF;

    data[20] = 0x04;

    send_command (s, 0x07, 1, 0xFFFF | stream_ids[0] << 16, 24, data);

    stream->fd = s;
    stream->streaming_ctrl->streaming_read = asf_mmst_streaming_read;
    stream->streaming_ctrl->streaming_seek = asf_mmst_streaming_seek;
    stream->streaming_ctrl->status = streaming_playing_e;
    stream->streaming = true;

    packet_length1 = packet_length;
    mp_msg(MSGT_NETWORK,MSGL_INFO,"mmst packet_length = %d\n", packet_length);

#ifdef CONFIG_ICONV
    if (url_conv != (iconv_t)(-1))
        iconv_close(url_conv);
#endif

    return 0;
}