Project: iSulad (Runtime / Container Runtime)
File: cni_operator_design.md

| Author | | | | - | | Date | 2021-01-22 | | Email | - | The cni-operator module encapsulates the libcni module, provides a more reasonable and friendly network management interface for generation, and is responsible for loading and updating network configuration files. ````c /* Description: Network management module initialization: Initialize libcni network module and network management layer data;; cache_dir: Network cache configuration file storage directory; conf_path: cni configuration file storage directory; bin_paths: cni plugin storage directory list; binpathslen: directory listing length; Return value: return 0 on success, non-zero on failure */ int cnimanagerstoreinit(const char *cachedir, const char conf_path, const char const *binpaths, sizet binpathslen); /* Description: According to the filtering rules, load the cni configuration file to the memory; store: cni configuration list; res_len: length of cni configuration list; filter_ops: Customize the cni configuration loading rules, and load the configuration files that meet the rules; Return value: return 0 on success, non-zero on failure */ int getnetconflistfromdir(struct cninetworklistconf ***store, sizet *reslen, cniconffiltert filter_ops); /* Description: Create a container loopback network id: container id; netns: container network namespace; Return value: return 0 on success, non-zero on failure */ int attach_loopback(const char id, const char netns); /* Description: delete the container loopback network id: container id; netns: container network namespace; Return value: return 0 on success, non-zero on failure */ int detach_loopback(const char id, const char netns); /* Description: Create a container single network plane; manager: The set of parameters required for container network creation; list: network configuration; result: record necessary network information; Return value: return 0 on success, non-zero on failure */ int attachnetworkplane(const struct cnimanager *manager, const struct cninetworklistconf list, struct cni_opt_result *result); /* Description: delete the container single network plane; manager: The set of parameters required for container network deletion; list: network configuration; result: record necessary network information; Return value: return 0 on success, non-zero on failure */ int detachnetworkplane(const struct cnimanager *manager, const struct cninetworklistconf list, struct cni_opt_result *result); /* Description: Check the status of the single network plane of the container; manager: set of parameters required for container network check; list: network configuration; result: record necessary network information; Return value: return 0 on success, non-zero on failure */ int checknetworkplane(const struct cnimanager *manager, const struct cninetworklistconf list, struct cni_opt_result *result); /* Description: get the CNI version information supported by the plugins required for the single network plane of the container; list: network configuration; resultversionlist: record the CNI version supported by the plugins; Return value: return 0 on success, non-zero on failure */ int versionnetworkplane(const struct cninetworklistconf *list, struct cniresultversionlist resultversionlist); ````