---
title: mmpm_handler_init
description: "初始化多模规则匹配handler。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2530/ida/kunpeng_datadistribution_01_0012.html
sourcePath: /source/zh/kunpengboostkithistory/2530/ida/kunpeng_datadistribution_01_0012.html
indexId: 8d74061cbbec30204f0173bb38434c79b480077bffb4f80beb1278eb0ae2db6580
---
# mmpm_handler_init

#### 接口功能

初始化多模规则匹配handler。


#### 接口定义

```
int mmpm_handler_init(mmpm_handler_t *handler, mmpm_matcher_type type, uint32_t buckets, uint32_t secondary_buckets);
```


#### 参数说明

| 参数名 | 描述 | 取值范围 | 输入/输出 |
| --- | --- | --- | --- |
| handler | 匹配引擎句柄 | 非NULL | 输入 |
| type | 匹配引擎种类 | mmpm\_matcher\_type枚举变量取值范围 | 输入 |
| buckets | 一级hash桶数量；输入为0则使用默认配置：10万一级桶 | 非负值，取值范围与uint32\_t保持一致 | 输入 |
| secondary\_buckets | 每个一级桶下的二级hash桶数量；输入为0则使用默认配置：每个一级桶下96个二级桶 | 非负值，取值范围与uint32\_t保持一致 | 输入 |


#### 返回值

- 成功：返回0。
- 失败：返回错误码。


#### 约束

请勿对同一句柄连续调用此函数。如要对同一句柄重新初始化，请先执行句柄销毁mmpm_handler_destroy，然后再重新执行mmpm_handler_init初始化。
