0
     ˆÅÄÈ479ÃÇÆ ß    ‹      ­“_oÚ0Åßû)îü°·äò¯hjOAD™¦iš&'6‰G°‘cºO?‡PÁ&ØViOIì“sîïÚ—¾Š§ƒÅçÙÞ/îÇ0ûøn< 	?uˆñ"n6za«�8œ ¹s›ÄªªÂª›ábŽ¹[=,�U©…„]Ñz�]Í%þ	Ô)WH6ÒBîÀ,ÍÖ•JÈ*ÁÝ›þ·~/(”Þî‚Lo±’ÉJ¹NæV�OG¥¿ËÔI$[-
I±qóþx ‰Ounû¿ex«}á<ÙGÕ¯–Q—Ã#/T¦#âÌ†0ªÖ”6�ªÔè“‚ëU˜©%^¸ˆ|¦_½]^ÿÍ(‡ÜÊeDÞ¢Éí4º#lÂ×>�Ÿ×Ü{MLØ˜—ÖF¨¥’â¢ø¡1|P?.Æ�&–ejÕÆ)£�Rôˆ§¨©)Ê÷¬×ž ·§ªF"þÖžþÒŒÙÝ|8YÄ£yÓQ[«{Ù‰6ãVj±²þèŒ}:€4®¯uRnnŸ?áP¦UYîà¬òl[½Ò¦Ò§x¾ugÁ<Î±øç›Ö\´°4„ýyÿë7ŽN«ÓZý Û‚vëæºp	¸Ýûpø�Ã@q?n›1ÿ	êX#×I    A   ˆl–ßi~”ªC]Šq@‚ãm\mµ1hß�þ[nVVq¢ÈGä[�€þÊ„€É_ˆI|¥�+y,ÉÈ ?÷     /*
 * %CopyrightBegin%
 *
 * Copyright Ericsson AB 1999-2022. All Rights Reserved.
 *
 * 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.
 *
 * %CopyrightEnd%
 */

/*
 * Include file for erlang driver writers.
 */

#ifndef __ERL_DRIVER_H__
#define __ERL_DRIVER_H__

#ifdef HAVE_CONFIG_H
#  include "config.h"
#endif

#define ERL_DRV_DEPRECATED_FUNC
#ifdef __GNUC__
#  if __GNUC__ >= 3
#    undef ERL_DRV_DEPRECATED_FUNC
#    define ERL_DRV_DEPRECATED_FUNC __attribute__((deprecated))
#  endif
#endif

#include "erl_drv_nif.h"

#include <stdlib.h>

#if defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_)
#ifndef STATIC_ERLANG_DRIVER
   /* Windows dynamic drivers, everything is different... */
#define ERL_DRIVER_TYPES_ONLY
#define WIN32_DYNAMIC_ERL_DRIVER
#endif
#endif

#ifndef EXTERN
#  ifdef __cplusplus
#    define EXTERN extern "C"
#  else
#    define EXTERN extern
#  endif
#endif

#define ERL_DRV_READ  ((int)ERL_NIF_SELECT_READ)
#define ERL_DRV_WRITE ((int)ERL_NIF_SELECT_WRITE)
#define ERL_DRV_USE   ((int)ERL_NIF_SELECT_STOP)
#define ERL_DRV_USE_NO_CALLBACK (ERL_DRV_USE | (ERL_DRV_USE  << 1))

/* Old deprecated */
#define DO_READ  ERL_DRV_READ
#define DO_WRITE ERL_DRV_WRITE

#define ERL_DRV_EXTENDED_MARKER		(0xfeeeeeed)
#define ERL_DRV_EXTENDED_MAJOR_VERSION	3
#define ERL_DRV_EXTENDED_MINOR_VERSION	3

/*
 * The emulator will refuse to load a driver with a major version
 * lower than ERL_DRV_MIN_REQUIRED_MAJOR_VERSION_ON_LOAD. The load
 * may however fail if user have not removed use of deprecated
 * symbols.
 *
 * The ERL_DRV_MIN_REQUIRED_MAJOR_VERSION_ON_LOAD have to allow
 * loading of drivers built at least two major OTP releases
 * ago.
 *
 * Bump of major version to 3 happened in OTP 17. That is, in
 * OTP 19 we can increase ERL_DRV_MIN_REQUIRED_MAJOR_VERSION_ON_LOAD
 * to 3.
 */
#define ERL_DRV_MIN_REQUIRED_MAJOR_VERSION_ON_LOAD 2

/*
 * The emulator will refuse to load a driver with different major
 * version than the one used by the emulator.
 */


/* Values for set_port_control_flags() */

#define PORT_CONTROL_FLAG_BINARY	(1 << 0)
#define PORT_CONTROL_FLAG_HEAVY		(1 << 1)

/* Values for get_port_flags() */

#define PORT_FLAG_BINARY                (1 << 0)
#define PORT_FLAG_LINE                  (1 << 1)


#define ERL_DRV_FLAG_USE_PORT_LOCKING	(1 << 0)
#define ERL_DRV_FLAG_SOFT_BUSY		(1 << 1)
#define ERL_DRV_FLAG_NO_BUSY_MSGQ	(1 << 2)
#define ERL_DRV_FLAG_USE_INIT_ACK	(1 << 3)

/*
 * Integer types
 */

typedef ErlNapiUInt64 ErlDrvUInt64;
typedef ErlNapiSInt64 ErlDrvSInt64;
typedef ErlNapiUInt ErlDrvUInt;
typedef ErlNapiSInt ErlDrvSInt;
typedef ErlNapiUInt ErlDrvTermData;

#if defined(__WIN32__) || defined(_WIN32)
typedef ErlDrvUInt ErlDrvSizeT;
typedef ErlDrvSInt ErlDrvSSizeT;
#else
typedef size_t ErlDrvSizeT;
typedef ssize_t ErlDrvSSizeT;
#endif

/*
 * A binary as seen in a driver. Note that a binary should never be
 * altered by the driver when it has been sent to Erlang.
 */

typedef struct erl_drv_binary {
    ErlDrvSInt orig_size;