Changeset View
Standalone View
sys/netgraph/bluetooth/include/ng_btsocket.h
Show First 20 Lines • Show All 222 Lines • ▼ Show 20 Lines | |||||
struct sockaddr_l2cap { | struct sockaddr_l2cap { | ||||
u_char l2cap_len; /* total length */ | u_char l2cap_len; /* total length */ | ||||
u_char l2cap_family; /* address family */ | u_char l2cap_family; /* address family */ | ||||
u_int16_t l2cap_psm; /* PSM (Protocol/Service Multiplexor) */ | u_int16_t l2cap_psm; /* PSM (Protocol/Service Multiplexor) */ | ||||
bdaddr_t l2cap_bdaddr; /* address */ | bdaddr_t l2cap_bdaddr; /* address */ | ||||
}; | }; | ||||
#define BDADDR_BREDR 0 | |||||
#define BDADDR_LE_PUBLIC 1 | |||||
#define BDADDR_LE_RANDOM 2 | |||||
emax: can you please make sure that this is not going to break the buildworld? | |||||
struct sockaddr_l2cap_new { | |||||
u_char l2cap_len; /* total length */ | |||||
u_char l2cap_family; /* address family */ | |||||
u_int16_t l2cap_psm; /* PSM (Protocol/Service Multiplexor) */ | |||||
bdaddr_t l2cap_bdaddr; /* address */ | |||||
u_int16_t l2cap_cid; /*cid*/ | |||||
u_int8_t l2cap_bdaddr_type; /*address type*/ | |||||
}; | |||||
Not Done Inline Actionsperhaps better name, i.e. sockaddr_l2cap_le? emax: perhaps better name, i.e. sockaddr_l2cap_le? | |||||
Not Done Inline ActionsShould I keep this compatibility shim permanently? takawata: Should I keep this compatibility shim permanently? | |||||
Not Done Inline Actionsi don't think so. i wonder if you can use l2cap_len here. basically, cast everything to sockaddr_l2cap (old version) to begin with. then check l2cap_len and compare it to sizeof(sockaddr_l2cap_new). if size matches, re-cast to sockaddr_l2cap_new. i think it should be possible to rename sockaddr_l2cap to sockaddr_l2cap_old and have new fields in sockaddr_l2cap by default. this way, applications complied with old sockaddr_l2cap will use sockaddr_l2cap_old and still work. so, i think, it would be better to add new fields to sockaddr_l2cap and have the rest of the code use it. compatibility shim probably should only exists in l2cap socket layer. emax: i don't think so.
i wonder if you can use l2cap_len here. basically, cast everything to… | |||||
Not Done Inline ActionsRenaming our new structure to sockaddr_l2cap would be good. takawata: Renaming our new structure to sockaddr_l2cap would be good.
But we should note it breaks source… | |||||
Not Done Inline Actionsi'm sorry, but i do not follow. there is l2cap_len field. any binary application would (ot at least should) have it set to size of the old sockaddr_l2cap. what i'm suggesting is to check l2cap_len first and cast pointer appropriately. we can rename structure safely then. emax: i'm sorry, but i do not follow. there is l2cap_len field. any binary application would (ot at… | |||||
Not Done Inline ActionsIf a programmer use new structure as old structure, takawata: If a programmer use new structure as old structure,
struct size is changed as new structure… | |||||
emaxUnsubmitted Not Done Inline Actionsplease either make new structure default, or, please move new fields into l2cap socket options. i think using l2cap_len works for binary backwards compatibility. source compatibility, where application fails to bzero(sockadd_l2cap) is a problem, but it will have to be addressed in the application. i personally think that having socket option for Bluetooth LE is acceptable, and, in some ways cleaner. however, for sake of better linux compatibility i'm fine with adding new fields to sockaddr_l2cap. emax: please either make new structure default, or, please move new fields into l2cap socket options. | |||||
takawataAuthorUnsubmitted Not Done Inline ActionsOk, I will name old structure sockaddr_l2cap_compat and new one sockaddr_l2cap_compat. Also warn structure change by preprossor directives. Socket option was used in Linux. but it has been changed in some reason. takawata: Ok, I will name old structure sockaddr_l2cap_compat and new one sockaddr_l2cap_compat.
Also… | |||||
/* L2CAP socket options */ | /* L2CAP socket options */ | ||||
#define SOL_L2CAP 0x1609 /* socket option level */ | #define SOL_L2CAP 0x1609 /* socket option level */ | ||||
#define SO_L2CAP_IMTU 1 /* get/set incoming MTU */ | #define SO_L2CAP_IMTU 1 /* get/set incoming MTU */ | ||||
#define SO_L2CAP_OMTU 2 /* get outgoing (peer incoming) MTU */ | #define SO_L2CAP_OMTU 2 /* get outgoing (peer incoming) MTU */ | ||||
#define SO_L2CAP_IFLOW 3 /* get incoming flow spec. */ | #define SO_L2CAP_IFLOW 3 /* get incoming flow spec. */ | ||||
#define SO_L2CAP_OFLOW 4 /* get/set outgoing flow spec. */ | #define SO_L2CAP_OFLOW 4 /* get/set outgoing flow spec. */ | ||||
#define SO_L2CAP_FLUSH 5 /* get/set flush timeout */ | #define SO_L2CAP_FLUSH 5 /* get/set flush timeout */ | ||||
▲ Show 20 Lines • Show All 123 Lines • Show Last 20 Lines |
can you please make sure that this is not going to break the buildworld?