mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-25 16:43:28 +00:00
implemented h5 slip decoder
This commit is contained in:
parent
f516be33dd
commit
9173c3e63a
333
3rdparty/LogExtension.mm
vendored
Normal file
333
3rdparty/LogExtension.mm
vendored
Normal file
@ -0,0 +1,333 @@
|
||||
/*
|
||||
* Copyright (C) 2009 by Matthias Ringwald
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holders nor the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
|
||||
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#import <Foundation/Foundation.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <termios.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
// hooking part
|
||||
#include "3rdparty/substrate.h"
|
||||
|
||||
// hci_dump.h
|
||||
typedef enum {
|
||||
HCI_DUMP_BLUEZ = 0,
|
||||
HCI_DUMP_PACKETLOGGER,
|
||||
HCI_DUMP_STDOUT
|
||||
} hci_dump_format_t;
|
||||
|
||||
static void hci_dump_open(char *filename, hci_dump_format_t format);
|
||||
static void hci_dump_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t len);
|
||||
static void hci_dump_close();
|
||||
|
||||
// H5 Slip Decoder
|
||||
|
||||
// h5 slip state machine
|
||||
typedef enum {
|
||||
unknown = 1,
|
||||
decoding,
|
||||
x_c0,
|
||||
x_db
|
||||
} state_t;
|
||||
|
||||
typedef struct h5_slip {
|
||||
state_t state;
|
||||
uint16_t length;
|
||||
uint8_t data[1000];
|
||||
} h5_slip_t;
|
||||
|
||||
// Global State
|
||||
static h5_slip_t read_sm;
|
||||
static h5_slip_t write_sm;
|
||||
static int bt_filedesc = 0;
|
||||
|
||||
void h5_slip_init( h5_slip_t * sm){
|
||||
sm->state = unknown;
|
||||
}
|
||||
|
||||
void h5_slip_process( h5_slip_t * sm, uint8_t input, uint8_t in){
|
||||
uint8_t type;
|
||||
switch (sm->state) {
|
||||
case unknown:
|
||||
if (input == 0xc0){
|
||||
sm->state = x_c0;
|
||||
}
|
||||
break;
|
||||
case decoding:
|
||||
switch (input ){
|
||||
case 0xc0:
|
||||
// packet done
|
||||
type = sm->data[1] & 0x0f;
|
||||
if (type >= 1 && type <= 4){
|
||||
hci_dump_packet( type, in, sm->data, sm->length);
|
||||
}
|
||||
sm->state = unknown;
|
||||
break;
|
||||
case 0xdb:
|
||||
sm->state = x_db;
|
||||
break;
|
||||
default:
|
||||
sm->data[sm->length] = input;
|
||||
++sm->length;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case x_c0:
|
||||
switch (input ){
|
||||
case 0xc0:
|
||||
break;
|
||||
case 0xdb:
|
||||
sm->state = x_db;
|
||||
break;
|
||||
default:
|
||||
sm->data[0] =input;
|
||||
sm->length = 1;
|
||||
sm->state = decoding;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case x_db:
|
||||
switch (input) {
|
||||
case 0xdc:
|
||||
sm->data[sm->length] = 0xc0;
|
||||
++sm->length;
|
||||
sm->state = decoding;
|
||||
break;
|
||||
case 0xdd:
|
||||
sm->data[sm->length] = 0xdb;
|
||||
++sm->length;
|
||||
sm->state = decoding;
|
||||
break;
|
||||
default:
|
||||
sm->state = unknown;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MSHook(int, socket, int domain, int type, int protocol){
|
||||
// call orig
|
||||
int res = _socket(domain, type, protocol);
|
||||
|
||||
// socket(0x20, 0x1, 0x2);
|
||||
if (domain == 0x20 && type == 0x01 && protocol == 0x02){
|
||||
printf("Opening BT device\n");
|
||||
bt_filedesc = res;
|
||||
hci_dump_open( "/tmp/BTServer.pklg", HCI_DUMP_PACKETLOGGER);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
MSHook( ssize_t, write, int fildes, const void *buf, size_t nbyte){
|
||||
if (fildes && fildes == bt_filedesc && nbyte > 0){
|
||||
int16_t i;
|
||||
for (i=0;i<nbyte;i++){
|
||||
h5_slip_process( &write_sm, ((uint8_t *)buf)[i], 0);
|
||||
}
|
||||
}
|
||||
return _write( fildes, buf, nbyte);
|
||||
}
|
||||
|
||||
MSHook( ssize_t, read, int fildes, void *buf, size_t nbyte){
|
||||
ssize_t res = _read( fildes, buf, nbyte);
|
||||
if (fildes && fildes == bt_filedesc && res > 0){
|
||||
int16_t i;
|
||||
for (i=0;i<res;i++){
|
||||
h5_slip_process( &read_sm, ((uint8_t *)buf)[i], 1);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
MSHook( int, close, int fildes){
|
||||
int res = _close( fildes);
|
||||
if (fildes && fildes == bt_filedesc){
|
||||
printf("Closing BT device\n");
|
||||
hci_dump_close();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void LogExtensionInitialize() {
|
||||
NSLog(@"LogExtensionInitialize!");
|
||||
|
||||
MSHookFunction(&socket, MSHake(socket));
|
||||
MSHookFunction(&read, MSHake(read));
|
||||
MSHookFunction(&write, MSHake(write));
|
||||
MSHookFunction(&close, MSHake(close));
|
||||
}
|
||||
|
||||
// HCI_DUMP
|
||||
|
||||
/**
|
||||
* packet types - used in BTstack and over the H4 UART interface
|
||||
*/
|
||||
#define HCI_COMMAND_DATA_PACKET 0x01
|
||||
#define HCI_ACL_DATA_PACKET 0x02
|
||||
#define HCI_SCO_DATA_PACKET 0x03
|
||||
#define HCI_EVENT_PACKET 0x04
|
||||
|
||||
// BLUEZ hcidump
|
||||
typedef struct {
|
||||
uint16_t len;
|
||||
uint8_t in;
|
||||
uint8_t pad;
|
||||
uint32_t ts_sec;
|
||||
uint32_t ts_usec;
|
||||
uint8_t packet_type;
|
||||
} __attribute__ ((packed)) hcidump_hdr;
|
||||
|
||||
// APPLE PacketLogger
|
||||
typedef struct {
|
||||
uint32_t len;
|
||||
uint32_t ts_sec;
|
||||
uint32_t ts_usec;
|
||||
uint8_t type;
|
||||
} __attribute__ ((packed)) pktlog_hdr;
|
||||
|
||||
static int dump_file = -1;
|
||||
static int dump_format;
|
||||
static hcidump_hdr header_bluez;
|
||||
static pktlog_hdr header_packetlogger;
|
||||
static char time_string[40];
|
||||
|
||||
static void bt_store_16(uint8_t *buffer, uint16_t pos, uint16_t value){
|
||||
buffer[pos++] = value;
|
||||
buffer[pos++] = value >> 8;
|
||||
}
|
||||
|
||||
static void bt_store_32(uint8_t *buffer, uint16_t pos, uint32_t value){
|
||||
buffer[pos++] = value;
|
||||
buffer[pos++] = value >> 8;
|
||||
buffer[pos++] = value >> 16;
|
||||
buffer[pos++] = value >> 24;
|
||||
}
|
||||
|
||||
static void hexdump(void *data, int size){
|
||||
int i;
|
||||
for (i=0; i<size;i++){
|
||||
printf("%02X ", ((uint8_t *)data)[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void hci_dump_open(char *filename, hci_dump_format_t format){
|
||||
dump_format = format;
|
||||
if (dump_format == HCI_DUMP_STDOUT) {
|
||||
dump_file = fileno(stdout);
|
||||
} else {
|
||||
dump_file = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
}
|
||||
}
|
||||
|
||||
static void hci_dump_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t len) {
|
||||
if (dump_file < 0) return; // not activated yet
|
||||
|
||||
// get time
|
||||
struct timeval curr_time;
|
||||
struct tm* ptm;
|
||||
gettimeofday(&curr_time, NULL);
|
||||
|
||||
switch (dump_format){
|
||||
case HCI_DUMP_STDOUT:
|
||||
/* Obtain the time of day, and convert it to a tm struct. */
|
||||
ptm = localtime (&curr_time.tv_sec);
|
||||
/* Format the date and time, down to a single second. */
|
||||
strftime (time_string, sizeof (time_string), "[%Y-%m-%d %H:%M:%S", ptm);
|
||||
/* Compute milliseconds from microseconds. */
|
||||
uint16_t milliseconds = curr_time.tv_usec / 1000;
|
||||
/* Print the formatted time, in seconds, followed by a decimal point
|
||||
and the milliseconds. */
|
||||
printf ("%s.%03u] ", time_string, milliseconds);
|
||||
switch (packet_type){
|
||||
case HCI_COMMAND_DATA_PACKET:
|
||||
printf("CMD => ");
|
||||
break;
|
||||
case HCI_EVENT_PACKET:
|
||||
printf("EVT <= ");
|
||||
break;
|
||||
case HCI_ACL_DATA_PACKET:
|
||||
if (in) {
|
||||
printf("ACL <= ");
|
||||
} else {
|
||||
printf("ACL => ");
|
||||
}
|
||||
break;
|
||||
}
|
||||
hexdump(packet, len);
|
||||
break;
|
||||
case HCI_DUMP_BLUEZ:
|
||||
bt_store_16( (uint8_t *) &header_bluez.len, 0, 1 + len);
|
||||
header_bluez.in = in;
|
||||
header_bluez.pad = 0;
|
||||
bt_store_32( (uint8_t *) &header_bluez.ts_sec, 0, curr_time.tv_sec);
|
||||
bt_store_32( (uint8_t *) &header_bluez.ts_usec, 0, curr_time.tv_usec);
|
||||
header_bluez.packet_type = packet_type;
|
||||
_write (dump_file, &header_bluez, sizeof(hcidump_hdr) );
|
||||
_write (dump_file, packet, len );
|
||||
break;
|
||||
case HCI_DUMP_PACKETLOGGER:
|
||||
header_packetlogger.len = htonl( sizeof(pktlog_hdr) - 4 + len);
|
||||
header_packetlogger.ts_sec = htonl(curr_time.tv_sec);
|
||||
header_packetlogger.ts_usec = htonl(curr_time.tv_usec);
|
||||
switch (packet_type){
|
||||
case HCI_COMMAND_DATA_PACKET:
|
||||
header_packetlogger.type = 0x00;
|
||||
break;
|
||||
case HCI_ACL_DATA_PACKET:
|
||||
if (in) {
|
||||
header_packetlogger.type = 0x03;
|
||||
} else {
|
||||
header_packetlogger.type = 0x02;
|
||||
}
|
||||
break;
|
||||
case HCI_EVENT_PACKET:
|
||||
header_packetlogger.type = 0x01;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
_write (dump_file, &header_packetlogger, sizeof(pktlog_hdr) );
|
||||
_write (dump_file, packet, len );
|
||||
}
|
||||
}
|
||||
|
||||
static void hci_dump_close(){
|
||||
_close(dump_file);
|
||||
dump_file = -1;
|
||||
}
|
27
3rdparty/Makefile
vendored
Normal file
27
3rdparty/Makefile
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
NAME = LogExtension
|
||||
|
||||
CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-gcc-4.0.1
|
||||
OBJC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-g++-4.0.1
|
||||
|
||||
CPPFLAGS = -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/include \
|
||||
-I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib/gcc/arm-apple-darwin9/4.0.1/include \
|
||||
-F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Library/Frameworks
|
||||
|
||||
LDFLAGS = -lobjc -Wl,-x \
|
||||
-multiply_defined suppress \
|
||||
-F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Library/Frameworks \
|
||||
-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib \
|
||||
-framework CoreFoundation \
|
||||
-framework QuartzCore \
|
||||
-framework Foundation \
|
||||
-framework UIKit \
|
||||
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices \
|
||||
-L3rdparty -lsubstrate
|
||||
|
||||
all: $(NAME).dylib
|
||||
|
||||
clean:
|
||||
rm -f $(NAME).dylib LogMe
|
||||
|
||||
$(NAME).dylib: $(NAME).mm
|
||||
$(OBJC) $(CPPFLAGS) -dynamiclib -o $@ $(NAME).mm -init _$(NAME)Initialize $(LDFLAGS)
|
237
3rdparty/launch.h
vendored
237
3rdparty/launch.h
vendored
@ -1,237 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#ifndef _LAUNCH_H_
|
||||
#define _LAUNCH_H_
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#pragma GCC visibility push(default)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define __ld_normal __attribute__((__nothrow__))
|
||||
#define __ld_setter __attribute__((__nothrow__, __nonnull__))
|
||||
#define __ld_getter __attribute__((__nothrow__, __nonnull__, __pure__, __warn_unused_result__))
|
||||
#define __ld_iterator(x, y) __attribute__((__nonnull__(x, y)))
|
||||
#define __ld_allocator __attribute__((__nothrow__, __malloc__, __nonnull__, __warn_unused_result__))
|
||||
#else
|
||||
#define __ld_normal
|
||||
#define __ld_setter
|
||||
#define __ld_getter
|
||||
#define __ld_iterator(x, y)
|
||||
#define __ld_allocator
|
||||
#endif
|
||||
|
||||
|
||||
#define LAUNCH_KEY_SUBMITJOB "SubmitJob"
|
||||
#define LAUNCH_KEY_REMOVEJOB "RemoveJob"
|
||||
#define LAUNCH_KEY_STARTJOB "StartJob"
|
||||
#define LAUNCH_KEY_STOPJOB "StopJob"
|
||||
#define LAUNCH_KEY_GETJOB "GetJob"
|
||||
#define LAUNCH_KEY_GETJOBS "GetJobs"
|
||||
#define LAUNCH_KEY_CHECKIN "CheckIn"
|
||||
|
||||
#define LAUNCH_JOBKEY_LABEL "Label"
|
||||
#define LAUNCH_JOBKEY_DISABLED "Disabled"
|
||||
#define LAUNCH_JOBKEY_USERNAME "UserName"
|
||||
#define LAUNCH_JOBKEY_GROUPNAME "GroupName"
|
||||
#define LAUNCH_JOBKEY_TIMEOUT "TimeOut"
|
||||
#define LAUNCH_JOBKEY_EXITTIMEOUT "ExitTimeOut"
|
||||
#define LAUNCH_JOBKEY_INITGROUPS "InitGroups"
|
||||
#define LAUNCH_JOBKEY_SOCKETS "Sockets"
|
||||
#define LAUNCH_JOBKEY_MACHSERVICES "MachServices"
|
||||
#define LAUNCH_JOBKEY_MACHSERVICELOOKUPPOLICIES "MachServiceLookupPolicies"
|
||||
#define LAUNCH_JOBKEY_INETDCOMPATIBILITY "inetdCompatibility"
|
||||
#define LAUNCH_JOBKEY_ENABLEGLOBBING "EnableGlobbing"
|
||||
#define LAUNCH_JOBKEY_PROGRAMARGUMENTS "ProgramArguments"
|
||||
#define LAUNCH_JOBKEY_PROGRAM "Program"
|
||||
#define LAUNCH_JOBKEY_ONDEMAND "OnDemand"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE "KeepAlive"
|
||||
#define LAUNCH_JOBKEY_LIMITLOADTOHOSTS "LimitLoadToHosts"
|
||||
#define LAUNCH_JOBKEY_LIMITLOADFROMHOSTS "LimitLoadFromHosts"
|
||||
#define LAUNCH_JOBKEY_LIMITLOADTOSESSIONTYPE "LimitLoadToSessionType"
|
||||
#define LAUNCH_JOBKEY_RUNATLOAD "RunAtLoad"
|
||||
#define LAUNCH_JOBKEY_ROOTDIRECTORY "RootDirectory"
|
||||
#define LAUNCH_JOBKEY_WORKINGDIRECTORY "WorkingDirectory"
|
||||
#define LAUNCH_JOBKEY_ENVIRONMENTVARIABLES "EnvironmentVariables"
|
||||
#define LAUNCH_JOBKEY_USERENVIRONMENTVARIABLES "UserEnvironmentVariables"
|
||||
#define LAUNCH_JOBKEY_UMASK "Umask"
|
||||
#define LAUNCH_JOBKEY_NICE "Nice"
|
||||
#define LAUNCH_JOBKEY_HOPEFULLYEXITSFIRST "HopefullyExitsFirst"
|
||||
#define LAUNCH_JOBKEY_HOPEFULLYEXITSLAST "HopefullyExitsLast"
|
||||
#define LAUNCH_JOBKEY_LOWPRIORITYIO "LowPriorityIO"
|
||||
#define LAUNCH_JOBKEY_SESSIONCREATE "SessionCreate"
|
||||
#define LAUNCH_JOBKEY_STARTONMOUNT "StartOnMount"
|
||||
#define LAUNCH_JOBKEY_SOFTRESOURCELIMITS "SoftResourceLimits"
|
||||
#define LAUNCH_JOBKEY_HARDRESOURCELIMITS "HardResourceLimits"
|
||||
#define LAUNCH_JOBKEY_STANDARDINPATH "StandardInPath"
|
||||
#define LAUNCH_JOBKEY_STANDARDOUTPATH "StandardOutPath"
|
||||
#define LAUNCH_JOBKEY_STANDARDERRORPATH "StandardErrorPath"
|
||||
#define LAUNCH_JOBKEY_DEBUG "Debug"
|
||||
#define LAUNCH_JOBKEY_WAITFORDEBUGGER "WaitForDebugger"
|
||||
#define LAUNCH_JOBKEY_QUEUEDIRECTORIES "QueueDirectories"
|
||||
#define LAUNCH_JOBKEY_WATCHPATHS "WatchPaths"
|
||||
#define LAUNCH_JOBKEY_STARTINTERVAL "StartInterval"
|
||||
#define LAUNCH_JOBKEY_STARTCALENDARINTERVAL "StartCalendarInterval"
|
||||
#define LAUNCH_JOBKEY_BONJOURFDS "BonjourFDs"
|
||||
#define LAUNCH_JOBKEY_LASTEXITSTATUS "LastExitStatus"
|
||||
#define LAUNCH_JOBKEY_PID "PID"
|
||||
#define LAUNCH_JOBKEY_THROTTLEINTERVAL "ThrottleInterval"
|
||||
#define LAUNCH_JOBKEY_LAUNCHONLYONCE "LaunchOnlyOnce"
|
||||
#define LAUNCH_JOBKEY_ABANDONPROCESSGROUP "AbandonProcessGroup"
|
||||
#define LAUNCH_JOBKEY_IGNOREPROCESSGROUPATSHUTDOWN "IgnoreProcessGroupAtShutdown"
|
||||
#define LAUNCH_JOBKEY_POLICIES "Policies"
|
||||
#define LAUNCH_JOBKEY_ENABLETRANSACTIONS "EnableTransactions"
|
||||
|
||||
#define LAUNCH_JOBPOLICY_DENYCREATINGOTHERJOBS "DenyCreatingOtherJobs"
|
||||
|
||||
#define LAUNCH_JOBINETDCOMPATIBILITY_WAIT "Wait"
|
||||
|
||||
#define LAUNCH_JOBKEY_MACH_RESETATCLOSE "ResetAtClose"
|
||||
#define LAUNCH_JOBKEY_MACH_HIDEUNTILCHECKIN "HideUntilCheckIn"
|
||||
#define LAUNCH_JOBKEY_MACH_DRAINMESSAGESONCRASH "DrainMessagesOnCrash"
|
||||
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_SUCCESSFULEXIT "SuccessfulExit"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_NETWORKSTATE "NetworkState"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_PATHSTATE "PathState"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_OTHERJOBACTIVE "OtherJobActive"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_OTHERJOBENABLED "OtherJobEnabled"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_AFTERINITIALDEMAND "AfterInitialDemand"
|
||||
|
||||
#define LAUNCH_JOBKEY_CAL_MINUTE "Minute"
|
||||
#define LAUNCH_JOBKEY_CAL_HOUR "Hour"
|
||||
#define LAUNCH_JOBKEY_CAL_DAY "Day"
|
||||
#define LAUNCH_JOBKEY_CAL_WEEKDAY "Weekday"
|
||||
#define LAUNCH_JOBKEY_CAL_MONTH "Month"
|
||||
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_CORE "Core"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_CPU "CPU"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_DATA "Data"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_FSIZE "FileSize"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_MEMLOCK "MemoryLock"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_NOFILE "NumberOfFiles"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_NPROC "NumberOfProcesses"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_RSS "ResidentSetSize"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_STACK "Stack"
|
||||
|
||||
#define LAUNCH_JOBKEY_DISABLED_MACHINETYPE "MachineType"
|
||||
#define LAUNCH_JOBKEY_DISABLED_MODELNAME "ModelName"
|
||||
|
||||
#define LAUNCH_JOBSOCKETKEY_TYPE "SockType"
|
||||
#define LAUNCH_JOBSOCKETKEY_PASSIVE "SockPassive"
|
||||
#define LAUNCH_JOBSOCKETKEY_BONJOUR "Bonjour"
|
||||
#define LAUNCH_JOBSOCKETKEY_SECUREWITHKEY "SecureSocketWithKey"
|
||||
#define LAUNCH_JOBSOCKETKEY_PATHNAME "SockPathName"
|
||||
#define LAUNCH_JOBSOCKETKEY_PATHMODE "SockPathMode"
|
||||
#define LAUNCH_JOBSOCKETKEY_NODENAME "SockNodeName"
|
||||
#define LAUNCH_JOBSOCKETKEY_SERVICENAME "SockServiceName"
|
||||
#define LAUNCH_JOBSOCKETKEY_FAMILY "SockFamily"
|
||||
#define LAUNCH_JOBSOCKETKEY_PROTOCOL "SockProtocol"
|
||||
#define LAUNCH_JOBSOCKETKEY_MULTICASTGROUP "MulticastGroup"
|
||||
|
||||
typedef struct _launch_data *launch_data_t;
|
||||
|
||||
typedef enum {
|
||||
LAUNCH_DATA_DICTIONARY = 1,
|
||||
LAUNCH_DATA_ARRAY,
|
||||
LAUNCH_DATA_FD,
|
||||
LAUNCH_DATA_INTEGER,
|
||||
LAUNCH_DATA_REAL,
|
||||
LAUNCH_DATA_BOOL,
|
||||
LAUNCH_DATA_STRING,
|
||||
LAUNCH_DATA_OPAQUE,
|
||||
LAUNCH_DATA_ERRNO,
|
||||
LAUNCH_DATA_MACHPORT,
|
||||
} launch_data_type_t;
|
||||
|
||||
launch_data_t launch_data_alloc(launch_data_type_t) __ld_allocator;
|
||||
launch_data_t launch_data_copy(launch_data_t) __ld_allocator;
|
||||
launch_data_type_t launch_data_get_type(const launch_data_t) __ld_getter;
|
||||
void launch_data_free(launch_data_t) __ld_setter;
|
||||
|
||||
/* Generic Dictionaries */
|
||||
/* the value should not be changed while iterating */
|
||||
bool launch_data_dict_insert(launch_data_t, const launch_data_t, const char *) __ld_setter;
|
||||
launch_data_t launch_data_dict_lookup(const launch_data_t, const char *) __ld_getter;
|
||||
bool launch_data_dict_remove(launch_data_t, const char *) __ld_setter;
|
||||
void launch_data_dict_iterate(const launch_data_t, void (*)(const launch_data_t, const char *, void *), void *) __ld_iterator(1, 2);
|
||||
size_t launch_data_dict_get_count(const launch_data_t) __ld_getter;
|
||||
|
||||
/* Generic Arrays */
|
||||
bool launch_data_array_set_index(launch_data_t, const launch_data_t, size_t) __ld_setter;
|
||||
launch_data_t launch_data_array_get_index(const launch_data_t, size_t) __ld_getter;
|
||||
size_t launch_data_array_get_count(const launch_data_t) __ld_getter;
|
||||
|
||||
launch_data_t launch_data_new_fd(int) __ld_allocator;
|
||||
launch_data_t launch_data_new_machport(mach_port_t) __ld_allocator;
|
||||
launch_data_t launch_data_new_integer(long long) __ld_allocator;
|
||||
launch_data_t launch_data_new_bool(bool) __ld_allocator;
|
||||
launch_data_t launch_data_new_real(double) __ld_allocator;
|
||||
launch_data_t launch_data_new_string(const char *) __ld_allocator;
|
||||
launch_data_t launch_data_new_opaque(const void *, size_t) __ld_allocator;
|
||||
|
||||
bool launch_data_set_fd(launch_data_t, int) __ld_setter;
|
||||
bool launch_data_set_machport(launch_data_t, mach_port_t) __ld_setter;
|
||||
bool launch_data_set_integer(launch_data_t, long long) __ld_setter;
|
||||
bool launch_data_set_bool(launch_data_t, bool) __ld_setter;
|
||||
bool launch_data_set_real(launch_data_t, double) __ld_setter;
|
||||
bool launch_data_set_string(launch_data_t, const char *) __ld_setter;
|
||||
bool launch_data_set_opaque(launch_data_t, const void *, size_t) __ld_setter;
|
||||
|
||||
int launch_data_get_fd(const launch_data_t) __ld_getter;
|
||||
mach_port_t launch_data_get_machport(const launch_data_t) __ld_getter;
|
||||
long long launch_data_get_integer(const launch_data_t) __ld_getter;
|
||||
bool launch_data_get_bool(const launch_data_t) __ld_getter;
|
||||
double launch_data_get_real(const launch_data_t) __ld_getter;
|
||||
const char * launch_data_get_string(const launch_data_t) __ld_getter;
|
||||
void * launch_data_get_opaque(const launch_data_t) __ld_getter;
|
||||
size_t launch_data_get_opaque_size(const launch_data_t) __ld_getter;
|
||||
int launch_data_get_errno(const launch_data_t) __ld_getter;
|
||||
|
||||
|
||||
/* launch_get_fd()
|
||||
*
|
||||
* Use this to get the FD if you're doing asynchronous I/O with select(),
|
||||
* poll() or kevent().
|
||||
*/
|
||||
int launch_get_fd(void) __ld_normal;
|
||||
|
||||
/* launch_msg()
|
||||
*
|
||||
* Use this API to send and receive messages.
|
||||
* Calling launch_msg() with no message to send is a valid way to get
|
||||
* asynchronously received messages.
|
||||
*
|
||||
* If a message was to be sent, it returns NULL and errno on failure.
|
||||
*
|
||||
* If no messages were to be sent, it returns NULL and errno is set to zero if
|
||||
* no more asynchronous messages are available.
|
||||
*/
|
||||
launch_data_t launch_msg(const launch_data_t) __ld_normal;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#pragma GCC visibility pop
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user