Home | History | Annotate | Line # | Download | only in base
      1 /*
      2  * Copyright (c) 2022 Apple Inc. All rights reserved.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *     https://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 //======================================================================================================================
     18 // MARK: - Headers
     19 
     20 #include "ref_count.h"
     21 #include "dns_obj.h"
     22 #include "dns_common.h"
     23 #include <stdint.h>
     24 #include <stdbool.h>
     25 
     26 #include "mdns_strict.h"
     27 
     28 //======================================================================================================================
     29 // MARK: - Object Public Methods
     30 
     31 dns_obj_t
     32 dns_obj_retain(const dns_obj_t me)
     33 {
     34 	ref_count_obj_retain(me);
     35 	return me;
     36 }
     37 
     38 //======================================================================================================================
     39 
     40 void
     41 dns_obj_release(const dns_obj_t me)
     42 {
     43 	ref_count_obj_release(me);
     44 }
     45 
     46 //======================================================================================================================
     47 
     48 bool
     49 dns_obj_equal(const dns_obj_t me, const dns_obj_t other)
     50 {
     51 	return ref_count_obj_compare(me, other, true) == compare_result_equal;
     52 }
     53 
     54 //======================================================================================================================
     55 
     56 compare_result_t
     57 dns_obj_compare(const dns_obj_t me, const dns_obj_t other)
     58 {
     59 	return ref_count_obj_compare(me, other, false);
     60 }
     61 
     62 //======================================================================================================================
     63 
     64 void
     65 dns_objs_sort(dns_obj_t * const us, const size_t count, const sort_order_t order)
     66 {
     67 	ref_count_objs_sort(us, count, order);
     68 }
     69