forked from kthchatt/Bittorrent
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathurlparse.h
27 lines (23 loc) · 947 Bytes
/
urlparse.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* urlparse.c
* 2014-04-17
* Author: Robin Duda
*
* Read data from URL.
* All methods are thread safe.
* The caller must allocate memory.
*/
#ifndef _urlparse_h
#define _urlparse_h
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "protocol_meta.h"
void url_hostname(char* url, char* host); //get hostname from url. (sub.domain.tld)
void url_protocol(char* url, char* protocol); //get protocol from url. (http/udp)
void url_announce(char* url, char* announce); //get file pointer form url. (/a_tracker/annunce.php)
void url_port(char* url, int *port); //get url (:xx..)
void url_path(char* url, char* path); //extract path from url.
int bdecode_value(char* source, char* search); //extract value from bencode string.
void url_encode(char* hash, char* output); //url-encode hash. output = 60.
void url_filesize(char* format_string, long long int size); //format a filesize
#endif