aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/libhicnctrl/includes/hicn/ctrl/objects/mapme.h
blob: 3eda1bfaa1038b65772d56cb00fff251ae7749ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * Copyright (c) 2021-2023 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * \file objects/mapme.h
 * \brief MAP-Me.
 */

#ifndef HICNCTRL_OBJECTS_MAPME_H
#define HICNCTRL_OBJECTS_MAPME_H

typedef enum {
  MAPME_TARGET_ENABLE,
  MAPME_TARGET_DISCOVERY,
  MAPME_TARGET_TIMESCALE,
  MAPME_TARGET_RETX,
} mapme_target_t;

static inline mapme_target_t mapme_target_from_str(char *mapme_target_str) {
  if (strcasecmp(mapme_target_str, "enable") == 0)
    return MAPME_TARGET_ENABLE;
  else if (strcasecmp(mapme_target_str, "discovery") == 0)
    return MAPME_TARGET_DISCOVERY;
  else if (strcasecmp(mapme_target_str, "timescale") == 0)
    return MAPME_TARGET_TIMESCALE;
  else
    return MAPME_TARGET_RETX;
}

#define MAX_MAPME_ARG_LEN 30

typedef struct {
  mapme_target_t target;
  // Command argument stored as a string
  // before being parsed into 'enabled' or 'timescale'
  char unparsed_arg[MAX_MAPME_ARG_LEN];

  uint8_t enabled;     // 1 = on, 0 = off
  uint32_t timescale;  // Milliseconds

  hicn_ip_address_t address;
  uint8_t family;
  uint8_t len;
  uint32_t face_id;
} hc_mapme_t;

#endif /* HICNCTRL_OBJECTS_MAPME_H */