more ota work-ota cmd line implemented-not tested

This commit is contained in:
sleclerc
2019-09-21 00:17:59 -04:00
parent 8aedca48a7
commit c01c33f72f
14 changed files with 2241 additions and 1957 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
* Misc utilities
*
* (c) Adrian Smith 2012-2014, triode1@btinternet.com
@@ -17,43 +17,43 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __UTIL_H
#define __UTIL_H
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "platform.h"
#include "pthread.h"
*/
#ifndef __UTIL_H
#define __UTIL_H
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "platform.h"
#include "pthread.h"
#define NFREE(p) if (p) { free(p); p = NULL; }
typedef struct metadata_s {
char *artist;
char *album;
char *title;
char *genre;
char *path;
char *artwork;
char *remote_title;
u32_t track;
u32_t duration;
u32_t track_hash;
u32_t sample_rate;
u8_t sample_size;
u8_t channels;
} metadata_t;
/*
void free_metadata(struct metadata_s *metadata);
void dup_metadata(struct metadata_s *dst, struct metadata_s *src);
*/
char *artist;
char *album;
char *title;
char *genre;
char *path;
char *artwork;
char *remote_title;
u32_t track;
u32_t duration;
u32_t track_hash;
u32_t sample_rate;
u8_t sample_size;
u8_t channels;
} metadata_t;
/*
void free_metadata(struct metadata_s *metadata);
void dup_metadata(struct metadata_s *dst, struct metadata_s *src);
*/
u32_t gettime_ms(void);
u32_t gettime_ms(void);
#ifdef WIN32
char* strsep(char** stringp, const char* delim);
@@ -64,22 +64,22 @@ void winsock_close(void);
#else
char *strlwr(char *str);
#endif
char* strextract(char *s1, char *beg, char *end);
in_addr_t get_localhost(char **name);
void get_mac(u8_t mac[]);
int shutdown_socket(int sd);
#endif
char* strextract(char *s1, char *beg, char *end);
in_addr_t get_localhost(char **name);
void get_mac(u8_t mac[]);
int shutdown_socket(int sd);
int bind_socket(short unsigned *port, int mode);
int conn_socket(unsigned short port);
typedef struct {
typedef struct {
char *key;
char *data;
char *data;
} key_data_t;
} key_data_t;
bool http_parse(int sock, char *method, key_data_t *rkd, char **body, int *len);
char* http_send(int sock, char *method, key_data_t *rkd);
char* kd_lookup(key_data_t *kd, char *key);
bool kd_add(key_data_t *kd, char *key, char *value);
bool kd_add(key_data_t *kd, char *key, char *value);
char* kd_dump(key_data_t *kd);