be/src/exprs/function/function_ip.cpp
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #include "exprs/function/function_ip.h" |
19 | | |
20 | | #include "exprs/function/simple_function_factory.h" |
21 | | |
22 | | namespace doris { |
23 | | |
24 | 1 | void register_function_ip(SimpleFunctionFactory& factory) { |
25 | | /// IPv4 convert between string and num part |
26 | 1 | factory.register_function<FunctionIPv4NumToString>(); |
27 | 1 | factory.register_alias(FunctionIPv4NumToString::name, "inet_ntoa"); |
28 | 1 | factory.register_function<FunctionIPv4StringToNum<IPConvertExceptionMode::Throw>>(); |
29 | 1 | factory.register_function<FunctionIPv4StringToNum<IPConvertExceptionMode::Default>>(); |
30 | 1 | factory.register_function<FunctionIPv4StringToNum<IPConvertExceptionMode::Null>>(); |
31 | 1 | factory.register_alias(FunctionIPv4StringToNum<IPConvertExceptionMode::Null>::name, |
32 | 1 | "inet_aton"); |
33 | | |
34 | | /// IPv6 convert between string and num part |
35 | 1 | factory.register_function<FunctionIPv6NumToString>(); |
36 | 1 | factory.register_alias(FunctionIPv6NumToString::name, "inet6_ntoa"); |
37 | 1 | factory.register_function<FunctionIPv6StringToNum<IPConvertExceptionMode::Throw>>(); |
38 | 1 | factory.register_function<FunctionIPv6StringToNum<IPConvertExceptionMode::Default>>(); |
39 | 1 | factory.register_function<FunctionIPv6StringToNum<IPConvertExceptionMode::Null>>(); |
40 | 1 | factory.register_alias(FunctionIPv6StringToNum<IPConvertExceptionMode::Null>::name, |
41 | 1 | "inet6_aton"); |
42 | | |
43 | | /// Judge part |
44 | 1 | factory.register_function<FunctionIsIPv4Compat>(); |
45 | 1 | factory.register_function<FunctionIsIPv4Mapped>(); |
46 | 1 | factory.register_function<FunctionIsIPString<IPv4>>(); |
47 | 1 | factory.register_function<FunctionIsIPString<IPv6>>(); |
48 | 1 | factory.register_function<FunctionIsIPAddressInRange>(); |
49 | | |
50 | | /// CIDR part |
51 | 1 | factory.register_function<FunctionIPv4CIDRToRange>(); |
52 | 1 | factory.register_function<FunctionIPv6CIDRToRange>(); |
53 | | |
54 | | /// Convert to IPv4/IPv6 part |
55 | 1 | factory.register_function<FunctionToIP<IPConvertExceptionMode::Throw, TYPE_IPV4>>(); |
56 | 1 | factory.register_function<FunctionToIP<IPConvertExceptionMode::Default, TYPE_IPV4>>(); |
57 | 1 | factory.register_function<FunctionToIP<IPConvertExceptionMode::Null, TYPE_IPV4>>(); |
58 | 1 | factory.register_function<FunctionToIP<IPConvertExceptionMode::Throw, TYPE_IPV6>>(); |
59 | 1 | factory.register_function<FunctionToIP<IPConvertExceptionMode::Default, TYPE_IPV6>>(); |
60 | 1 | factory.register_function<FunctionToIP<IPConvertExceptionMode::Null, TYPE_IPV6>>(); |
61 | | |
62 | | /// Convert between IPv4 and IPv6 part |
63 | 1 | factory.register_function<FunctionIPv4ToIPv6>(); |
64 | | |
65 | | /// Cut IPv6 part |
66 | 1 | factory.register_function<FunctionCutIPv6>(); |
67 | | |
68 | | // Covert to IPv6 from uint128-string |
69 | 1 | factory.register_function<FunctionIPv6FromUInt128StringOrNull>(); |
70 | 1 | } |
71 | | } // namespace doris |