All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jnr.posix.MacOSSocketMacros Maven / Gradle / Ivy

The newest version!
package jnr.posix;

import jnr.ffi.Pointer;

/**
 * @author Bob McWhirter
 */
public class MacOSSocketMacros implements SocketMacros {

    public static final SocketMacros INSTANCE = new MacOSSocketMacros();

    public int __DARWIN_ALIGN32(int x) {
        return ((x + 3) & ~3);
    }

    public int CMSG_SPACE(int l) {
        return __DARWIN_ALIGN32(MacOSCmsgHdr.layout.size()) + __DARWIN_ALIGN32(l);
    }

    public int CMSG_LEN(int l) {
        return (__DARWIN_ALIGN32(MacOSCmsgHdr.layout.size())) + (l);
    }

    public Pointer CMSG_DATA(Pointer cmsg) {
        return cmsg.slice(__DARWIN_ALIGN32(MacOSCmsgHdr.layout.size()));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy