F1CTL/Core/Inc/http_server.h

44 lines
730 B
C

#ifndef __HTTP_SERVER_H
#define __HTTP_SERVER_H
#ifdef __cplusplus
extern "C" {
#endif
#include "socket.h"
#include "w5500_init.h"
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
#include "protocol.h"
#define HTTP_SERVER_PORT 80
#define HTTP_SERVER_SOCKET 1
#define MAX_URI_SIZE 128
// HTTP请求方法
typedef enum {
HTTP_GET,
HTTP_POST,
HTTP_UNKNOWN
} http_method;
// HTTP请求结构
typedef struct {
http_method method;
char uri[MAX_URI_SIZE];
uint8_t* body;
uint16_t body_length;
} http_request;
// 初始化HTTP服务器
void http_server_init(void);
// 处理HTTP服务器任务
void http_server_task(void);
#ifdef __cplusplus
}
#endif
#endif /* __HTTP_SERVER_H */