libnx  v4.8.0
binder.h
1 #pragma once
2 #include "../types.h"
3 #include "../kernel/event.h"
4 #include "../sf/service.h"
5 
6 #define BINDER_FIRST_CALL_TRANSACTION 0x1
7 
8 typedef struct {
9  bool created;
10  bool initialized;
11  s32 id;
12  size_t dummy;
13  Service* relay;
14 } Binder;
15 
16 // Note: binderClose will not close the session_handle provided to binderCreate.
17 void binderCreate(Binder* b, s32 id);
18 void binderClose(Binder* b);
19 
20 Result binderInitSession(Binder* b, Service* relay);
21 
22 Result binderTransactParcel(
23  Binder* b, u32 code,
24  void* parcel_data, size_t parcel_data_size,
25  void* parcel_reply, size_t parcel_reply_size,
26  u32 flags);
27 
28 Result binderConvertErrorCode(s32 code);
29 
30 Result binderAdjustRefcount(Binder* b, s32 addval, s32 type);
31 Result binderGetNativeHandle(Binder* b, u32 unk0, Event *event_out);
32 
33 static inline Result binderIncreaseWeakRef(Binder* b)
34 {
35  return binderAdjustRefcount(b, 1, 0);
36 }
37 
38 static inline Result binderDecreaseWeakRef(Binder* b)
39 {
40  return binderAdjustRefcount(b, -1, 0);
41 }
42 
43 static inline Result binderIncreaseStrongRef(Binder* b)
44 {
45  return binderAdjustRefcount(b, 1, 1);
46 }
47 
48 static inline Result binderDecreaseStrongRef(Binder* b)
49 {
50  return binderAdjustRefcount(b, -1, 1);
51 }
Definition: binder.h:8
Kernel-mode event structure.
Definition: event.h:13
Service object structure.
Definition: service.h:14
u32 Result
Function error code result type.
Definition: types.h:44
int32_t s32
32-bit signed integer.
Definition: types.h:27
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21