create new project.

除sapp和插件之外, 其他模块也经常有从某个层跳转到某个层的需求,
从sapp中剥离此部分代码, 独立成为一个公共库.
This commit is contained in:
lijia
2021-09-14 15:50:53 +08:00
commit f6f399f69a
17 changed files with 4371 additions and 0 deletions

30
inc/MESA_jump_layer.h Normal file
View File

@@ -0,0 +1,30 @@
#ifndef __MESA_JUMP_LAYER_H_
#define __MESA_JUMP_LAYER_H_ 1
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include "stream.h"
#include <netinet/ip.h>
#include <netinet/ip6.h>
const char *MESA_jump_layer_get_last_error(void);
/*
The raw_layer_type and expect_layer_type refer to sapp_base.h->enum addr_type_t
*/
const void *MESA_net_jump_to_layer(const void *raw_data, int raw_layer_type, int expect_layer_type);
const void *MESA_net_jump_to_layer_greedy(const void *raw_data, int raw_layer_type, int expect_layer_type);
const char *MESA_jump_layer_ipv4_ntop(const struct ip *ip4_hdr, char *out_buf, int buf_len );
const char *MESA_jump_layer_ipv6_ntop(const struct ip6_hdr *ip6_hdr, char *out_buf, int buf_len);
#ifdef __cplusplus
}
#endif